0

Following is how my controller in Angular 1.x looks like -

const app = angular.module("userRegistration", [
  "some-dep",
  "templates",
  "ngRoute",
  "ngResource",
  "ngCookies",
  "userRegistration.controllers",
  "userRegistration.services",
  "userRegistration.directives"
]);

Everything runs fine but once in a while, the following error surfaces, mostly on a windows machine with Chrome browser version >= 62 -

Uncaught Error: [$injector:modulerr] Failed to instantiate module userRegistration due to: Error: [$injector:nomod] Module 'userRegistration' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 

I came to know from another SO post that the issue lies in the syntax. The correct syntax is

var app = angular.module("MesaViewer", []);

But I am not sure why this error never sprang up in past. I tried to repro the issue on the same chrome browser version but was unable to.

comiventor
  • 3,922
  • 5
  • 50
  • 77

1 Answers1

0

Can you pls try this..

const app = angular.module("userRegistration", [
  "some-dep",
  "templates",
  "ngRoute",
  "ngResource",
  "ngCookies"
]);

There is not need to inject the controller, services, etc from the same module

Rakesh Burbure
  • 1,045
  • 12
  • 27
  • I will try this but I would never know if this fixes the issue until it re-occurs OR stops occurring in production as I am unable to repro this issue locally – comiventor Feb 04 '18 at 09:41