Please advice,
I am creating rest client with json output using angular js , although rest data has received, but it never populated correctly into view html.
is there any wrong $scope data defined at angular controller?
Below is the json rest output data.
{
"Job": [
{
"id": "1",
"prize": "car"
}
]
}
and the javascript controller with name "some.js"
var app = angular.module("MyApp", []);
app.controller("PostsCtrl", function($scope, $http) {
$http.get('jsonURL').
success(function(data, status, headers, config) {
$scope.posts = data.Job;
}).
error(function(data, status, headers, config) {
});
});
and html view
<!doctype html>
<html ng-app="MyApp">
<head>
<title>Test AngularJS</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.js"></script>
<script src="some.js"></script>
</head>
<body>
<div ng-controller="PostsCtrl">
<ul ng-repeat="post in posts">
<p>The ID is {{post.id}}</p>
<p>The prize is {{post.prize}}</p>
</ul>
</div>
</body>
</html>
console.log
call in error handler to see if it is firing – charlietfl 2 days ago