有没有AngularJS$http的finally这样的东西?

有没有AngularJS$http的finally这样的东西?,angularjs,Angularjs,我有这样的代码: $http({ method: 'POST', url: "/api/Account/Register", data: { userName: userName, password: password, confirmPassword: confirmPassword } }) .success(function ()

我有这样的代码:

    $http({
        method: 'POST',
        url: "/api/Account/Register",
        data: {
            userName: userName,
            password: password,
            confirmPassword: confirmPassword
        }
    })
    .success(function () {
        successCallback();
    })
    .error(function (data) {
        errorCallback(data);
    })

有没有什么方法可以用AngularJS添加一个最终回调?

$http
返回的承诺与使用创建的任何其他承诺相同。这意味着它将有一个
finally
方法:

$http({ /* ... */ })
.success(function () {})
.error(function () {})
.finally(function () {});
从:

返回带有标准then方法和两个http特定方法的promise对象


是的,自1.2.0rc1以来,有一个
finally
方法,如所示。自1.1.5起,该方法被称为
始终

$http({
        method: 'POST',
        url: "/api/Account/Register",
        data: {
            userName: userName,
            password: password,
            confirmPassword: confirmPassword
        }
    })
    .success(successCallback)
    .error(errorCallback)
    .finally(finallyCallback)
;