0

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

1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I added swordfish.app = new swordfish.app(); to the bottom of app.ts & it worked. I had to change a few other bits around the controller registration but it's now working correctly. Appreciate the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.