my RESTful API returns an array:
GET /test => [1367297123312,1.0,2.0,3.0,100]
I have a service:
(angular
.module('app.services', ['ng', 'ngResource'])
.factory('myData', [
'$resource',
function ($resource) {
return $resource('test');
}])
);
In my controller I need to get numbers. I tried:
(angular
.module('app.controllers', ['ng', 'app.services'])
.controller('tweetsapiContr', [
'$scope', 'myData',
function ($scope, myData) {
myData.get({}, function (data) {
console.log(data);
};
}
])
);
The above gives me an error TypeError: Object #<h> has no method 'push', and if I use queryinstead getin the service, it returns an array of objects with methods such as $get, $saveetc., but the call $get, for example, returns undefined.
How to get numbers? The answer with the hash from the server works, but I'm trying to figure out how to make it work with arrays.
source
share