You would use setFullResponse in your modules config to grab the status code on a successful request.
https://github.com/mgonto/restangular#setfullresponse
var app = angular.module('app', ['restangular']);
// Change setFullResponse to be true in the modules config.
app.config(['RestangularProvider', function (RestangularProvider) {
RestangularProvider.setFullResponse(true);
}]);
// Using the new response format.
app.controller('someController', ['Restangular', function (Restangular) {
Restangular.all('orders').getList().then(function (result) {
// Response from the server.
console.log(result.data);
// Response status code.
console.log(result.status);
});
}]);
Coffeescriptified:
app = angular.module('app', ['restangular'])
// Change setFullResponse to be true in the modules config.
app.config ['RestangularProvider', (RestangularProvider) ->
RestangularProvider.setFullResponse true
]
// Using the new response format.
app.controller 'someController', ['Restangular', (Restangular) ->
Restangular.all('orders').getList().then (result) ->
// Response from the server.
console.log result.data
// Response status code.
console.log result.status
]
Hope this helps!