angularjs - Iterating objects or arrays inside ng-repeat -
the json i'm passing view has objects , arrays inside of it. example:
{ name: "test", projects: [ { name: "project1", tasks: "task1" } ] }
using ng-repeat, can (key, value) in items
, given you'd expect, each key , stringified version of object or array.
is there 'best practice' iterating on objects , arrays inside ng-repeat?
just following answer, able figure out. simpler realized. used ng-repeat items arrays.
<div class="container" ng-repeat="item in items"> <table class="table table-striped table-bordered table-condensed"> <tr> <th class="span3">name</th> <td>{{ item.name }}</td> </tr> <tr> <th class="span3">accounts</th> <td> <ul ng-repeat="account in item.accounts"> <li>username: {{ account.username }}</li> <li>password: {{ account.password }}</li> </ul> </td> </tr> </table>
Comments
Post a Comment