简体   繁体   English

未捕获TypeScript的AngularJS错误:[$ injector:modulerr]

[英]AngularJS with TypeScript Uncaught Error: [$injector:modulerr]

I'm trying to convert an AngularJS app I built a while ago to TypeScript. 我正在尝试将我之前构建的AngularJS应用程序转换为TypeScript。 I've written what I think is correct for the initial app.ts file, but upon compiling & trying to open my app in the browser, I get a Uncaught Error: [$injector:modulerr] error in the console. 我已经写了我认为对于初始app.ts文件正确的内容,但是在编译并尝试在浏览器中打开我的应用程序时,控制台中出现了Uncaught Error:[$ injector:modulerr]错误。

I've added all the code to the Gist below, I was wondering if someone could shed some light on why this error is occurring? 我将所有代码添加到下面的要点中,我想知道是否有人可以阐明为什么会发生此错误?

https://gist.github.com/matt-major/32f53036643e3fc7c65e https://gist.github.com/matt-major/32f53036643e3fc7c65e

I see you have the module as a class 我看到你把模块当作一个类

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);

What I don't see is someone calling it. 我没有看到有人打电话吧。 You would need to get the line angular.module('swordfish', swordfish.helpers.registeredDependencies); 您将需要获得angular.module('swordfish', swordfish.helpers.registeredDependencies); executed for angular to detect this module. 执行angular检测该模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM