It appears that the issue revolves around this particular code snippet:
$http.get('/someUrl'). success(function(data, status, headers,
config) {
There is a distinct difference between using success
and then
,
The then
method is used to register callbacks, with each callback receiving an object representing the response
In essence, you should be approaching it in this manner:
$http.get(...).success(function(data){ console.log(data) })
$http.get(...).then(function(response){ console.log(response.data) })
Furthermore, there are chaining distinctions, although they may not be directly related to your current problem:
then()
When chaining then()
, the callbacks will execute sequentially one after the other due to the return of a new promise object on each chain
success()
(deprecated* alongside error()
)
If you chain success()
calls, the callbacks will run in parallel as it returns the original promise object
*Both success
and error
are deprecated features, refer to the Deprecation Notice section in the $http documentation