It is viable to get ngRepeat to iterate over the houses of an object using the subsequent syntax:
<div ng-repeat="(key, value) in myObj"> ... </div>
Below code will iterate the object keys using ng-repeat
However, there are a few limitations compared to array iteration:
- ngRepeat will silently ignore object keys starting with $, because it's a prefix used by AngularJS for public ($) and private ($$) properties.
- The built-in filters orderBy and filter do not work with objects, and will throw an error if used with one.
If you are hitting any of these limitations, the recommended workaround is to convert your object into an array that is sorted into the order that you prefer before providing it to ngRepeat. You could do this with a filter such as toArrayFilter or implement a $watch on the object yourself.Demo