C# Corner
Tech
News
Videos
Forums
Trainings
Books
Live
More
Interviews
Events
Jobs
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Bind Mixed Json to Table in AngularJS
WhatsApp
Nemilidinne Ashokreddy
Nov 24
2015
922
0
0
Here you find Full code:
<!DOCTYPE html>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<title></title>
<script src=
"Scripts/angular.min.js"
></script>
<script>
var app = angular.module(
"myApp"
, []);
app.controller(
'MyCtrl'
, function ($scope)
{
$scope.alldata = [
{
"_id"
:
1
,
"name"
:
{
"first"
:
"John"
,
"last"
:
"Backus"
},
"contribs"
: [
"Fortran"
,
"ALGOL"
,
"Backus-Naur Form"
,
"FP"
],
"awards"
: [
{
"award"
:
"W.W. McDowell Award"
,
"year"
:
1967
,
"by"
:
"IEEE Computer Society"
},
{
"award"
:
"Draper Prize"
,
"year"
:
1993
,
"by"
:
"National Academy of Engineering"
}]
}];
});
</script>
</head>
<body ng-app=
"myApp"
ng-controller=
"MyCtrl"
>
<table>
<tbody ng-
repeat
=
"dat in alldata"
>
<tr>
<td colspan=
"3"
>{{dat.name.first}} {{dat.name.last}}</td>
</tr>
<tr>
<td colspan=
"3"
align=
"center"
><span style=
"font-weight:bold"
>Contribution</span></td>
</tr>
<tr ng-
repeat
=
"cont in dat.contribs"
>
<td colspan=
"3"
>{{ cont}}</td>
</tr>
<tr>
<td colspan=
"3"
align=
"center"
><span style=
"font-weight:bold"
>Awards</span></td>
</tr>
<tr ng-
repeat
=
"aw in dat.awards"
>
<td>{{ aw.award}}</td>
<td>{{ aw.year}}</td>
<td>{{ aw.by}}</td>
</tr>
</tbody>
</table>
</body>
</html>
AngularJS
JSON
Ng-repeat
Up Next
Bind Mixed Json to Table in AngularJS