How to use ng-repeat to iterate over map entries in AngularJS

后端 未结 1 1421
情歌与酒
情歌与酒 2020-12-05 16:51

How would you iterate over the entries in map such that both the entry key and the value can be printed? For example, I\'d like to do something like this:

&l         


        
相关标签:
1条回答
  • 2020-12-05 17:36

    From the docs, I found this syntax works:

    <ul>
        <li ng-repeat='(key, value) in {"First Name":"John", "Last Name":"Smith"}'>
            <span>Key: {{key}}, value: {{value}}</span>
        </li>
    </ul>
    
    0 讨论(0)
提交回复
热议问题