angularjs - Rectangular addResponseInterceptor data object undefined while has it in response object -
using restangular, method/promise resolves result handed .then() empty...with console.log(data); showing undefined. checked network tab in chromium debug , xhr request 200 success...there full json response in body.
using addresponseinterceptor
, have found data argument undefined, response argument shows object containing data property payload/body.
so, left scratching head.....why data argument undefined while response object contains json payload/response in response.data?
i need resolve result passed .then() on resolve.
createnode: function(node) { var account = "9936"; var eventid = "0fd6afd9-4aa0-a5c9-ff0b3e60cdcf"; restangular.addresponseinterceptor(function(data, operation, what, url, response, deferred) { console.log("````````````````"); console.log(data); console.log(operation); console.log(what); console.log(url); console.log(response); console.log(deferred); console.log("````````````````"); });
node.js:12 undefined node.js:13 node.js:14 event node.js:15 /1.0/loadbalancers/account/9936/event/0fd6afd9-4aa0-a5c9-ff0b3e60cdcf node.js:16 ^object {data: object, status: 200, headers: function, config: object} config: object data: object automation: object classification: array[2] executiontimestamp: "2014-08-13t16:08:37.4676z" id: "0fd6afd9-a5c9-ff0b3e60cdcf" incident: object laststatus: "enqueued" metadata: object name: "node create" recordlogs: false source: "device lifecycle" stream: object targets: array[1]
make sure response interceptors return data @ end:
restangular.addresponseinterceptor(function(data, operation, what, url, response, deferred) { // code here return data; });
not returning set data undefined
on following response interceptors calls.
Comments
Post a Comment