(js) Improve Angular modules initialization

This commit is contained in:
Francis Lachapelle 2015-07-29 15:16:43 -04:00
parent 7e10cff395
commit d3a233b222
2 changed files with 18 additions and 1 deletions

View file

@ -51,7 +51,16 @@
return Message; // return constructor return Message; // return constructor
}]; }];
/* Factory registration in Angular module */ /**
* @module SOGo.MailerUI
* @desc Factory registration of Message in Angular module.
*/
try {
angular.module('SOGo.MailerUI');
}
catch(e) {
angular.module('SOGo.MailerUI', ['SOGo.Common']);
}
angular.module('SOGo.MailerUI') angular.module('SOGo.MailerUI')
.factory('Message', Message.$factory); .factory('Message', Message.$factory);

View file

@ -69,6 +69,14 @@
return new Preferences(); // return unique instance return new Preferences(); // return unique instance
}]; }];
/* Initialize module if necessary */
try {
angular.module('SOGo.PreferencesUI');
}
catch(e) {
angular.module('SOGo.PreferencesUI', ['SOGo.Common']);
}
/* Factory registration in Angular module */ /* Factory registration in Angular module */
angular.module('SOGo.PreferencesUI') angular.module('SOGo.PreferencesUI')
.factory('Preferences', Preferences.$factory); .factory('Preferences', Preferences.$factory);