如何在AngularDart中使用拦截器?

时间:2018-02-21 01:18:42

标签: dart interceptor angular-dart angular-http-interceptors

我有一个AngularJS应用,其中包含这个简单的http-interceptor

'use strict';
app.factory('myInterceptorService', ['$q','$location', function ($q,$location) {

    var myInterceptorServiceFactory = {};

    var _request = function (config) {
        // some code
    }

    var _responseError = function (rejection) {
        // some code
    }

    myInterceptorServiceFactory.request = _request;
    myInterceptorServiceFactory.responseError = _responseError;

    return myInterceptorServiceFactory;
}]);

我按照这样注册拦截器:

app.config(function ($httpProvider) {
    $httpProvider.interceptors.push('myInterceptorService');
});

但是,我无法在AngularDart中以任何方式执行此操作。请问有什么建议吗?

0 个答案:

没有答案