0

I have an application that uses Angular and it works properly nearly (nearly) everywhere. Suddenly we deployed a version on a Linux server and it fails. This is the only place that we ever experienced an issue.

My app dinamically loads modal windows and this is the line where it fails:

var $injector = angular.injector(['ng', 'AccountApp']);

For some reason my AccountApp which is declared on a separated .js file it's not loaded properly.

var ngapp = angular.module('AccountApp', []);
ngapp.controller('MainController', ['$scope', function ($scope) {
...

I've been looking for a solution for about a week, testing some minor changes, loading it in a different way but nothing solved my problem. The weird thing is it only happens in this specific server:

Here it's the uname command:

Linux xxxxxx 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

My question is a bit different to solve the problem, what is the reason that a Linux distribution could affect Angular? Might be Apache? I couldn't find anything that guides me to the answer.

This is the error message I get:

Failed to instantiate module ngapp due to: Error: [$injector:nomod] http://errors.angularjs.org/1.2.27/$injector/nomod?p0=ngapp at Error (native)

Thanks in advance.

Maximiliano Rios
  • 2,196
  • 2
  • 20
  • 34
  • Are you sure your app was deployed completely to the problem server? From the error message, it looks like something is referencing an angular module called "ngapp" and it looks like your main app module is "AccountApp" now. Is there an ng-app="ngapp" in your html? – Brad Barber Feb 23 '15 at 20:33
  • It's completely deployed, it took me a while to compare everything. It's declared in one of the main views
    – Maximiliano Rios Feb 23 '15 at 21:45
  • The ng-app and ng-controller need to match the module and controller names defined in your js. But that doesn't explain why it works on some machines and not others...maybe caching issues? – Brad Barber Feb 23 '15 at 22:38
  • Good point, I deleted the caché and also I removed caching features on the server and there was no progress.... it's one of these weird errors I cannot identify – Maximiliano Rios Feb 24 '15 at 02:24
  • Where do you have angular.module('ngapp', [...]) defined? And did you really intend to have multiple ng-app definition? I haven't dealt with using multiple ng-app definitions in an app before and you need to manually bootstrap any additional ng-app definitions: http://stackoverflow.com/questions/18571301/angularjs-multiple-ng-app-within-a-page – Brad Barber Feb 24 '15 at 14:03

0 Answers0