javascript - How to display a dynamic sub field in angular -
javascript - How to display a dynamic sub field in angular -
i'm writing dynamic forms application in angular.js , i'm stuck on how access sub objects in list.
i have collection of objects, , collection of list columns. want display fields each record in collection depending on columns specified.
the code listed below works of objects, not others. in example, root displayed, sub.start isn't. understand why doesn't, i'm wondering how can work.
var collection = [ {root: 'b', sub: {start: 't' }} ]; var columns = [ { field: 'root' }, { field: "sub.start"}, ]; <tr ng-repeat="item in collection"> <td ng-repeat="column in columns" >{{ item[column.field] }}</td> </tr>
this won't work because item["sub.start"] doesn't exist.
your collection have structured this:
{ root: "b", "sub.start": "t" }
javascript angularjs
Comments
Post a Comment