java - How would I do an Angular JS ng-repeat on this JSON parse? -
how angular js ng-repeat on json parse?
.controller('teamsctrl', function($scope) { var text = '{"employees":[' + '{"name":"john doe"},' + '{"name":"sam doe"},' + '{"name":"jack doe"}]}'; /* create scope property recognized in view*/ $scope.tasks = json.parse(text); });
here area want populated new content:
<ion-content class="has-header" ng-controller="teamsctrl"> <div class="list card" ng-repeat="employee in tasks.employee" ng-click="showactionsheet()"> <div class="item item-divider"> <div>{{employee.name}}</div> </div>
you aren't assigning parsed results scope variable
controller should more like:
.controller('teamsctrl', function($scope) { var text = '{"employees":[' + '{"name":"john doe"},' + '{"name":"sam doe"},' + '{"name":"jack doe"}]}'; /* create scope property recognized in view*/ $scope.tasks = json.parse(text); });
then in markup can like:
class="lang-html prettyprint-override"><div ng-repeat="employee in tasks.employees"> <div>{{employee.name}}</div> </div>
demo
java javascript angularjs content-management-system hybrid-mobile-app
No comments:
Post a Comment