Angularjs tutorial

Page 22

Angular JS Tutorial

</div>

ng-model directive The ng-model directive defines the model/variable to be used in AngularJS Application. In the following example, we define a model named name. <div ng-app=""> ... <p>Enter your Name: <input type="text" ng-model="name"></p> </div>

ng-repeat directive ng-repeat directive repeats HTML elements for each item in a collection. In the following example, we iterate over the array of countries. <div ng-app=""> ... <p>List of Countries with locale:</p> <ol> <li ng-repeat="country in countries"> {{ 'Country: ' + country.name + ', Locale: ' + country.locale }} </li> </ol> </div>

Example The following example shows the use of all the above mentioned directives. testAngularJS.htm <html> <title>AngularJS Directives</title>

16


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.