AngularJs ng-repeat


AngularJs ng-repeat directive : AngularJs ng-repeat directive is used to iterate for each element in collection.


Syntax : AngularJs ng-repeat

<div ng-app = ''>
<div ng-app="" ng-init="myArr=['First Item','Second Item','Third Item', 'Fourth Item','Fifth Item']"  >
    <p data-ng-repeat="a in myArr" style="background:yellow;border:1px solid red; margin:10px;">{{a}}</p>
</div>
</div>

Note you can give your ng-app name.

Let us understand with simple example

Example 1

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
</head>

<body>
<div ng-app = ''>
<div ng-app="" ng-init="myArr=['First Item','Second Item','Third Item', 'Fourth Item','Fifth Item']"  >
    <p data-ng-repeat="a in myArr" style="background:yellow;border:1px solid red; margin:10px;">{{a}}</p>
</div>
</div>
</body>
</html>

Try it »


Advertisements

Add Comment

📖 Read More