Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Coffeescript 成功的重新启动请求时访问HTTP状态代码_Coffeescript_Http Status Codes_Restangular - Fatal编程技术网

Coffeescript 成功的重新启动请求时访问HTTP状态代码

Coffeescript 成功的重新启动请求时访问HTTP状态代码,coffeescript,http-status-codes,restangular,Coffeescript,Http Status Codes,Restangular,在使用Restanglar成功请求后,如何访问HTTP响应状态代码 咖啡脚本示例 我试图实现一个响应提取器,将其作为元数据附加,但当它流入提取器时,状态代码已经被剥离。您可以在模块配置中使用setFullResponse在成功请求时获取状态代码 咖啡说明: app = angular.module('app', ['restangular']) // Change setFullResponse to be true in the modules config. app.config ['R

在使用Restanglar成功请求后,如何访问HTTP响应状态代码

咖啡脚本示例
我试图实现一个响应提取器,将其作为元数据附加,但当它流入提取器时,状态代码已经被剥离。

您可以在模块配置中使用setFullResponse在成功请求时获取状态代码

咖啡说明:

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
]
希望这有帮助

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);
    });
}]);
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
]