如何迭代地图中的条目,以便可以打印输入键和值?例如,我想做这样的事情:
<ul> <li ng-repeat='mapEntry in {"First Name":"John","Last Name":"Smith"}'> <span>Key: {{mapEntry.key}},value: {{mapEntry.value}}</span> </li> </ul>
从
docs,我发现这个语法工作:
<ul> <li ng-repeat='(key,value) in {"First Name":"John","Last Name":"Smith"}'> <span>Key: {{key}},value: {{value}}</span> </li> </ul>