I have an issue with loading module using requireJS. I've got two files:
File1: app1/js/utils/commons/commons.js
define("utils/commons/commons",
[
"../../../../app2/MenuModule"
], function (MenuModule) {
//MenuModule is undefined here
var app = angular.module('commons', ['MenuModule']);
});
File2: app2/MenuModule.js
define("../../../../app2/MenuModule",
[
"../../../../app2/MenuController",
"../../../../app2/MenuRestProvider"
], function (MenuController,
MenuRestProvider) {
var app = angular.module('MenuModule', []);
app.factory('MenuRestProvider', MenuRestProvider);
app.controller('MenuController', MenuController);
return app;
});
The point is: File1 loads File2, and 'define' function from File2 is run. Dependencies from File2 are not fetched, and function passed to 'define' function is not evaluated. Can you see what causes this problem?
../
in the name of the module (this is most probably the culprit, I bet) (3) Long../
chains (really fragile) and (4) Suspicious dependency paths in file2 (shouldn't"../../../../app2/MenuController"
simply be"./app2/MenuController"
or even"app2/MenuController"
?) – Nikos Paraskevopoulos