To list data from array, we shall use ng-repeat directive.
In this example, we shall initialize the array inline with the help of ng-init directive.
<div ng-app ng-init="usernames = ['Sheo', 'Narayan', 'Dutta']">
<ul>
<li ng-repeat="username in usernames">{{username}}</li>
</ul>
</div>
In the above code snippet, we have kept ng-app attribute in the div itself and there is no ng-controller directive here as the initialization of the array is happening inline to this div tag with the help of ng-init directive.
Now, the ng-repeat directive is looping through each element of the usernames array and writing its value with the help of {{ username }} expression.
Output
Views: 12095 | Post Order: 21