Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in Web Technology by (47.6k points)

In my controller, I have data like: $scope.object = data

Now, this data is a dictionary with keys and values from json.

I can access the attribute with object.name in the template. Is there any way that I can iterate over the keys as well and display them in the table like

<tr><td> {{key}} </td> <td> data.key </td>

The data is like this

{

"id": 2,

"project": "wewe2012",

"date": "2013-02-26",

"description": "ewew",

"eet_no": "ewew",

}

1 Answer

+2 votes
by (106k points)
edited by

If you want to iterate over the keys and values with ng-repeat in AngularJS you can do by using the below-mentioned 

Are you interested in learning Angularjs from the basics! Here's the right video for you on Angularjs provided by Intellipaat:

code:-

<table>

<tr ng-repeat="(key, value) in data">

<td> {{key}} </td>

<td> {{ value }} </td>

</tr>

</table>

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...