Tuesday, April 21, 2015

AngularJs ng-init directive

The ng-init directive initializes an AngularJS Application data.

 It is used to assign values to the variables.

In the following example, we initialize an array of countries. We use JSON syntax to define the array of countries.

<div ng-app="" ng-init="countries=[{locale:'en-US',name:'United States'},
 {locale:'en-GB',name:'United Kingdom'},
 {locale:'en-FR',name:'France'}]">

No comments:

Post a Comment