Я пытаюсь преобразовать угловые модули Javascript в TypeScript. В настоящее время я использую загрузчик модулей ES6. И Пытаться конвертировать каждый модуль по одному. Я конвертировал один модуль в TypeScript, но имел проблемы с загрузчиком ES6, не загружая контроллеры и директивы.Загрузчик модуля ES6 не загружает угловой контроллер, написанный с использованием TypeScript
Вот мой app.js
:
import {editFieldModule} from './modules/field/editField/editField.module';
//Some other Angular Modules written ES6 ///
export var comp = angular.module('comp',[ "comp.modules.editField",//someother]);
Вот мой Angular module
написано в TypeScript
.
var editFieldModule: ng.IModule = angular.module("comp.modules.editField", []);
export {editFieldModule};
Это мой Controller
.
/// <reference path="../../../../thirdparty/angular-material/angular-material.d.ts"/>
/// <reference path="../../../../thirdparty/angular/angular.d.ts"/>
/// <reference path="../../../../thirdparty/angular-ui-router/api/angular-ui-router.d.ts"/>
module features.editField {
var app = angular.module('comp.modules.editField');
export class EditFieldController {
static $inject: string[] = ["$mdDialog", "$state"];
constructor(private _mdDialog: any, private _state: ng.ui.IStateService) {}
showConfirmation(ev: any) {
let tempThis = this;
tempThis._mdDialog.show({
controller: 'editFieldCancelDialogController',
controllerAs: 'vm',
templateUrl: 'test.html',
parent: angular.element(document.body),
targetEvent: ev
});
}
}
app.controller('editFieldController', features.editField.EditFieldController);
}
Адрес: directive
.
module features.editField {
var app = angular.module('comp.modules.editField');
export class EditFieldDirective implements ng.IDirective {
public restrict: string = 'E';
public controller: string = 'editFieldController';
public templateUrl: string = 'app/modules/field/editField/editField.tmpl.html';
public controllerAs: string = 'vm';
public bindToController: boolean = true;
public link = function() {
console.log('instantiating directive!');
}
}
app.directive("efpEditField", [() => new features.editField.EditFieldDirective()]);
}
Я вижу, что мой модуль загружается, но контроллер и директива никогда не регистрируются и не загружаются вообще. Может ли кто-нибудь сказать мне, где я делаю ошибку.