javascript - ng-repeat not pushing data -
i'm using ng-repeat directive list set of json data of format
$scope.result=[ { "id": 84, "resource": { "id": 3, "name": "resource planning", "description": "test" }, "activity": { "id": 6, "name": "activity planning", "description": "test" } } ]
my usage of ng-repeat this..
<div ng-repet="data in result">{{data.resource.name}} {{data.activity.name}}</div>
i'm able display name ie., "resouce planning" , "activity planning". can't push data if i'm doing
$scope.result.push({resource.name:result.resource.name,activity.name:result.activity.name})
from controller. there way push name inside object. , display/list same using ng-repeat? thanks
i don't understand question, that's not how build javascript object. should like:
$scope.result.push({ resource: { name: result.resource.name }, activity: { name: result.activity.name } })
Comments
Post a Comment