How to use ng-repeat to iterate over map entries in AngularJS
AngularjsAngularjs Problem Overview
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:
<ul>
<li ng-repeat='mapEntry in {"First Name":"John", "Last Name":"Smith"}'>
<span>Key: {{mapEntry.key}}, value: {{mapEntry.value}}</span>
</li>
</ul>
Angularjs Solutions
Solution 1 - Angularjs
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>