<html>
<head>
<title>How to Loop through items returned by a function with ng-repeat?</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script>
var parentApp = angular.module("myApp", []);
parentApp.controller("MyController", function($scope) {
var userDetail = {
ID: 1,
Name: 'Anil Singh',
Age: 30
};
$scope.getUsers = function(){
return userDetail;
}
});
</script>
</head>
<body ng-app="myApp">
<h2>User Details</h2>
<div ng-controller="MyController">
<div ng-init="user = getUsers()">
<div>ID : {{user.ID}}</div>
<div>Name : {{user.Name}}</div>
<div>Age : {{user.Age}}</div>
</div>
</div>
</body>
</html>
// Code goes here
/* Styles go here */