I have an API that has the following response
{"keyA": [1, 2,5], "Kibi": [3,6,4], "key": [3,2,1]}
And I have a very simple service Using the API end point
var $ module = angular Modules ('mySimpleService', ['NgrSource']); $ Module.service ('MyApiService', function ($ resource) {return {entities: $ resource ('http://myapi.com/data', null, {'get': {method: 'GET', isArray: Wrong, feedback type: 'json'}}}}}}}
and I am calling service like this
var apiData = MyApiService .entities.get (). $ Commitment then (function (data) {console.log (data); console.log (object key (data));});
When I log out of data and object keys, I can see that angular has been added to $ promise
and $ resolved
in the form of properties Because on data I need to calculate the key, it is a little uncomfortable.
Am I missing a significant step here? How can I use my raw untainted response?
Instead of making promises, you can use callback to get the unit example .get
Receive.
EntitiesApiService.entities.get (function (unit) {// unit is unpolted}); You can tap, function (error) {
and to check the failures with the choice. $ Promise
can be used.
Comments
Post a Comment