Monday, 19 September 2016
AngularJs Nested Array of Objects With ng-repeat Table in MVC | PHP | Html
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<body>
<div ng-app="App" ng-controller="studentsCtrl">
<table border="1">
<tr ng-repeat="x in stdDetails.students">
<td>{{ x.Name }}
</td>
<td>{{ x.Country }}
</td>
<td ng-repeat="m in x.Marks">{{m.Maths}}
</td>
<td ng-repeat="m in x.Marks">{{m.Physics}}
</td>
</tr>
</table>
</div>
<script>
var app = angular.module('App', []);
app.controller('studentsCtrl', function($scope) {
$scope.stdDetails={
"students": [
{
"Name": "Raja",
"City": "Hyderabad",
"Country": "India",
"Marks":[
{
"Maths":"75",
"Physics":"90"
}
]
}
,
{
"Name": "Ramu",
"City": "CF",
"Country": "USA",
"Marks":[
{
"Maths":"95",
"Physics":"60"
}
]
}
]
}
}
);
</script>
</body>
</html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<body>
<div ng-app="App" ng-controller="studentsCtrl">
<table border="1">
<tr ng-repeat="x in stdDetails.students">
<td>{{ x.Name }}
</td>
<td>{{ x.Country }}
</td>
<td ng-repeat="m in x.Marks">{{m.Maths}}
</td>
<td ng-repeat="m in x.Marks">{{m.Physics}}
</td>
</tr>
</table>
</div>
<script>
var app = angular.module('App', []);
app.controller('studentsCtrl', function($scope) {
$scope.stdDetails={
"students": [
{
"Name": "Raja",
"City": "Hyderabad",
"Country": "India",
"Marks":[
{
"Maths":"75",
"Physics":"90"
}
]
}
,
{
"Name": "Ramu",
"City": "CF",
"Country": "USA",
"Marks":[
{
"Maths":"95",
"Physics":"60"
}
]
}
]
}
}
);
</script>
</body>
</html>
Subscribe to:
Post Comments
(
Atom
)
Buy your own premium oakley titanium glasses
ReplyDeleteA great choice for titanium watches you when you micro touch hair trimmer order a titanium nose jewelry beer with a titanium fishing pliers special 2017 ford focus titanium price tag. These quality crafted glassworks have a quality, quality design that