How to Use ng-repeat in AngularJs



Here give you detailed example how to use ng-repeat in angularjs. 

The ng-repeat directive in AngularJS.  ng-repeat instantiates a set of HTML or template for each item in the given collection.

HTML:-----

<!DOCTYPE html> <html ng-app="unified"> <head> <meta charset="utf-8" /> <title>Ng-repeat in angularjs</title> <script src="~/scripts/angular.min.js"></script> <script src="app.js"></script> </head> <body ng-controller="RootCtrl"> <ul ng-repeat="Emp in Emplist"> <li> {{Emp.name}} <ul ng-repeat="Emps in Emp.post"> <li>{{Emp.prof}}</li> </ul> </li> </ul> </body> </html>


Javascript:---app.js///

var app = angular.module('unified', []); app.controller('RootCtrl', function($scope) { $scope.Emplist= [ { "name": "Empoyee" }, { "name": "Managment" } ]; $scope.Emp.post= [ { "prof": "developer" }, { "prof": "admin" } ]; });



OUTPUT:---



























Hope you like the post . Please share and comment the queries below or customer care section.

Thanks,

Post a Comment

0 Comments