angularjs - failed to get nested json value into ng-repeat -


my data:

var user = [{     'uid': 1,     'name': 'eldy',     'relationship': [{         'uid':2,         'name': 'jeremy',         'tabs':[{                 'tabid':1             }],         'tasks':[{                 'name':'tasks 1 of jeremy lin'             }, {                 'name':'tasks 1 of jeremy lin'             }, {                 'name':'tasks 1 of jeremy lin'             }],         'points': 50         },          {             'uid':3,         'name': 'jordon',         'tabs':[{                 'tabid':2             }],         'tasks':[{                 'name':'im jordon'             }],         'points': 100         }     ] }] 

i want access tasks of relationship array, tried

<ul ng-repeat="user in user">     <li ng-repeat="tasks in user.relationship.tasks">         {{tasks[0].name}}     </li> </ul> 

but returned blank. have problem working nested json, tools that?

it's bad practise have "user in user" ambiguous. try renaming variable "users" avoid confusion.

next you'll need either add repeat relationship, array, or print first user:

user.relationship[0].tasks. 

edit:

here fiddle showing how can done ng-repeat http://jsbin.com/diyefevi/7/edit?html,js,output


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -