AngularJS - How can I reference the property name within an ng-Repeat

前端 未结 2 937
孤独总比滥情好
孤独总比滥情好 2020-11-28 03:21

In addition to rendering the value of the properties in an object, I\'d also like to render the property name as a label. Is there a way to do this with ng-repeat

相关标签:
2条回答
  • 2020-11-28 03:36

    The problem with documentation is that it says (key, value) with that space ... it took me some time to figure out that because of that it doesn't work

    0 讨论(0)
  • 2020-11-28 03:52

    Try this:

    <ul>
        <li ng-repeat="(key,val) in data">{{key}}: {{val}}</li>
    </ul>
    
    0 讨论(0)
提交回复
热议问题