My current task involves iterating through a JSON file using AngularJS. Below is the function that I am working with:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script>
function PostsCtrlAjax($scope, $http) {
$http({method: 'POST', url: 'posts.json'}).success(function(data) {
$scope.tasks = data;
});
}
</script>
<div id="ng-app" ng-app ng-controller="PostsCtrlAjax">
<div ng-repeat="task in tasks.objects">
<script type="text/javascript">
var adviser1 = new primitives.orgdiagram.ItemConfig("{{task.name}}", "{{task.description}}", "http://www.basicprimitives.com/demo/images/photos/z.png");
</script>
</div>
</div>
When using {{task.name}}
, the output shows up as {{task.name}}, rather than the actual content of the variable. How can I make it display the variable's value? Also, when I remove the quotes, nothing is displayed. Any suggestions on how to rectify this?
Would appreciate some guidance on resolving this issue.