How can I list keys and values ​​in angularjs?

Possible duplicate:
AngularJS - How can I refer to a property name in ng-Repeat

I have a JSON file like this:

fields: { alias: { type: "string", }, name: { type: "string", } } 

I want something like this:

 <dl ng-repeat="for field in fields.items"> <dt> {{ field.key }} </dt> <dd> {{ field.value }} </dd> </dl> 

early!

+4
source share
1 answer

according to ngRepeat docs you can use "(key, value) in the expression" as parameters ", where the key and value can be any user-defined identifiers, and the expression is a scope expression that allows the collection to be counted.

For example: (name, age) in {'adam': 10, 'amalie': 12}.

http://docs.angularjs.org/api/ng.directive:ngRepeat

+14
source

All Articles