Javascript angular.route.IRouteParamsService的定义在哪里?
我在控制器中定义了对routeParams服务的本地引用Javascript angular.route.IRouteParamsService的定义在哪里?,javascript,angularjs,typescript,tsd,Javascript,Angularjs,Typescript,Tsd,我在控制器中定义了对routeParams服务的本地引用routeParams:IRouteParamsServiceWebstorm甚至还为我完成了这项工作,并在我的控制器顶部生成了一条导入语句: import IRouteParamsService = angular.route.IRouteParamsService; 但是,这会产生一个typescript错误 模块“Angular”没有导出的属性“route” 我尝试删除它,尝试将angular ui router.d.ts添加到我的
routeParams:IRouteParamsService
Webstorm甚至还为我完成了这项工作,并在我的控制器顶部生成了一条导入语句:
import IRouteParamsService = angular.route.IRouteParamsService;
但是,这会产生一个typescript错误
模块“Angular”没有导出的属性“route”
我尝试删除它,尝试将angular ui router.d.ts
添加到我的TSD typings集合中。也许我丢失了另一个TSD定义文件
下面是我的注入器/构造器的其他有用部分
import ILocationProvider = angular.ILocationProvider;
import IRouteParamsService = angular.route.IRouteParamsService;
import IScope = angular.IScope;
interface ILoginControllerScope extends IScope {
userObject:any;
//...
}
class LoginController {
formType = 'login';
userModel:UserModel;
location:ILocationProvider;
routeParams: IRouteParamsService;
scope:ILoginControllerScope;
static $inject = ['$scope', '$location', 'userModel', '$routeParams'];
constructor($scope, $location, $userModel, routeParams ){
this.scope = $scope;
this.location = $location;
this.userModel = $userModel;
this.routeParams = routeParams;
//...
您使用内置路由器(又名$routeProvider)还是ui路由器(又名$stateProvider)。在第一种情况下,您需要angular-route.d.ts,在第二种情况下,您需要angular-ui-router.d.ts。如果它仍然失败,编译器可能不会获取这个定义文件?哦,糟了。我完全使用了不匹配的tsd。