Matt
Matt

Reputation: 211

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

I'm trying to convert an AngularJS app I built a while ago to 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.

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

Upvotes: 0

Views: 416

Answers (1)

basarat
basarat

Reputation: 276393

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); executed for angular to detect this module.

Upvotes: 1

Related Questions