Issue
I am new to angular js, i wanted to assign the suncorp data which is equal to response into an array , what's wrong with the code? . is the result an array of data? . btw dont worry about the services its working the data is from an api (https://jobs.search.gov/jobs/search.json?query=nursing+jobs).
function TESTController($scope, testFac) {
/* console.log("TESTControlleris now available.");*/
$scope.data1= [];
testFac.getData().then(function(response) {
$scope.data1 = response.data;
console.log("Data:",$scope.data1);
})
Solution
if response.data
is not an array
, and you want the data in an array then, you need to push data to array using array push method;
function TESTController($scope, testFac) {
/* console.log("TESTControlleris now available.");*/
$scope.data1= [];
testFac.getData().then(function(response) {
$scope.data1.push(response.data);
console.log("Data:",$scope.data1);
})
Answered By - Ved
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.