May 13, 2016

showing two dimentional JSON in angularJS

Belo is the code definig about showing two dimentional JSON in angularJS. Its a beginners action of displaying records. You can learn fancy methods of manupulating logics in angularJS.

/* showing two dimention JSON in angularJS */

<!DOCTYPE html>
<html>
<script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js”></script>
<body>

<div ng-app=”helloApp” ng-init=”{{companies}}”>
<div ng-controller=”CompanyCtrl” >
<p>Looping with ng-repeat:</p>
<ul>
<li ng-repeat=”x in companies”>
{{ x.name }} {{ x.employees }} {{ x.headoffice }}
</li>
</ul>
</div>
</div>

<script>
var helloApp = angular.module(“helloApp”, []);

helloApp.controller(“CompanyCtrl”, function($scope) {
$scope.companies = [
{ ‘name’:’Infosys Technologies’,
’employees’: 125000,
‘headoffice’: ‘Bangalore’},
{ ‘name’:’Cognizant Technologies’,
’employees’: 100000,
‘headoffice’: ‘Bangalore’},
{ ‘name’:’Wipro’,
’employees’: 115000,
‘headoffice’: ‘Bangalore’},
{ ‘name’:’Tata Consultancy Services (TCS)’,
’employees’: 150000,
‘headoffice’: ‘Bangalore’},
{ ‘name’:’HCL Technologies’,
’employees’: 90000,
‘headoffice’: ‘Noida’},
];
});
</script>
</body>
</html>

You may also like...

Leave a Reply