Looping in Angular JS

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
$scope.names = [
{name:'Sachin',country:'Norway'},
{name:'Saurabh',country:'Sweden'},
{name:'Gaurav',country:'Denmark'}
];
});
</script><div ng-app="myApp" ng-controller="namesCtrl">

<ul>
<li ng-repeat="x in names">
{{ x.name + ', ' + x.country }}
</li>
</ul>

</div>

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *