我正在尝试将我不久前构建的AngularJS应用程序转换为TypeScript。我已经为初始 app.ts 文件编写了我认为正确的内容,但在编译并尝试在浏览器中打开我的应用程序时,我收到一个未捕获的错误:控制台中的 [$injector:modulerr] 错误。
我已经将所有代码添加到下面的 Gist 中,我想知道是否有人可以阐明为什么会发生此错误?
https://gist.github.com/matt-major/32f53036643e3fc7c65e
我看到您将模块作为一个类
export class app {
private angularModule: ng.IModule;
/**
* The Class Constructor
*/
constructor() {
swordfish.helpers.registerDependencies(['ngRoute']);
this.angularModule = angular.module('swordfish', swordfish.helpers.registeredDependencies);
this.moduleRegister('swordfish.controllers', swordfish.controllers);
我没有看到有人在打电话。您需要执行行angular.module('swordfish', swordfish.helpers.registeredDependencies);
,angular
才能检测到此模块。