コントローラーで routeParams サービスへのローカル ref を定義しました。routeParams:IRouteParamsService
Webstorm のコードでもこれが完了し、コントローラーの上部に import ステートメントが生成されました。
import IRouteParamsService = angular.route.IRouteParamsService;
ただし、これにより typescript エラーが発生し、
モジュール 'Angular' には、エクスポートされたプロパティ 'route' がありません
私はそれを削除しようとしangular-ui-router.d.ts
ましたが、私の TSD タイピング コレクションに追加しようとしました。別の 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;
//...