TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Bind Mixed Json to Table in AngularJS
Nemilidinne Ashokreddy
Nov 24
2015
Code
869
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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
Ng-repeat
JSON