Javascript Angularjs+;http侦听器上的strictdi错误(typescript)

Javascript Angularjs+;http侦听器上的strictdi错误(typescript),javascript,angularjs,typescript,Javascript,Angularjs,Typescript,我正在使用Typescript编写一个简单的Angularjs测试应用程序。为了缩小规模,我还强制执行ng严格di 我创建了一个简单的app.ts文件: declare var angular: ng.IAngularStatic; module Application { "use strict"; export var app: ng.IModule = angular.module("Private", ["ngRoute"]); app.config(($httpProvider:

我正在使用Typescript编写一个简单的Angularjs测试应用程序。为了缩小规模,我还强制执行ng严格di

我创建了一个简单的app.ts文件:

declare var angular: ng.IAngularStatic;
module Application {
"use strict";

export var app: ng.IModule = angular.module("Private", ["ngRoute"]);

app.config(($httpProvider: ng.IHttpProvider) => {
    $httpProvider.interceptors.push(Common.Services.HttpInterceptor.Factory);
});

app.config(["$routeProvider", ($routeProvider: ng.route.IRouteProvider) => {
        $routeProvider.when("/home", { templateUrl: "home.html" }); 
        $routeProvider.otherwise({ redirectTo: "/" });
    }]);
}
如您所见,HTTP拦截器正在推送

Common.Services.HttpInterceptor.Factory
其组成如下:

module Common.Services {
    export class HttpInterceptor {
        public static Factory($http: ng.IHttpService) {
            return new HttpInterceptor($http);
        }

        static $inject = ["$http"];
            constructor($http: ng.IHttpService) {
        }

        public response = ((response) => { return response  })

        public responseError = ((rejection) => {
            return rejection;
        });
    }
}
就像你看到的那样简单。 但每次我回家都会犯这样的错误:

错误:[$injector:strictdi]函数($http)未使用显式批注,无法在严格模式下调用 $injector/strictdi?p0=函数(%24http)

但我在

static $inject = ["$http"];
我不知道怎么解决这个问题

如果这有什么帮助,请遵循编译后的js:

var Application;
(function (Application) {
    "use strict";
    Application.app = angular.module("Private", ["ngRoute"]);

    Application.app.config(["$httpProvider", function ($httpProvider) {
        $httpProvider.interceptors.push(Common.Services.HttpInterceptor.Factory);
    }]);
    Application.app.config(["$routeProvider", function ($routeProvider) {            
            $routeProvider.when("/home", { templateUrl: "home.html" });
            $routeProvider.otherwise({ redirectTo: "/" });
        }]);
})(Application || (Application = {}));

var Common;
(function (Common) {
    var Services;
    (function (Services) {
        var HttpInterceptor = (function () {
            function HttpInterceptor($http) {
                this.response = (function (response) { return response; });
                this.responseError = (function (rejection) {
                    return rejection;
                });
            }
            HttpInterceptor.Factory = function ($http) {
                return new HttpInterceptor($http);
            };
            HttpInterceptor.$inject = ["$http"];
            return HttpInterceptor;
        })();
        Services.HttpInterceptor = HttpInterceptor;
    })(Services = Common.Services || (Common.Services = {}));
})(Common || (Common = {}));
谢谢你的帮助! V.

下的HttpInterceptor
也注入工厂方法:

HttpInterceptor.Factory.$inject=['$http']