В настоящее время я пытаюсь ссылаться на один модуль AngularJS в различных директивах и службах, подобных приведенным ниже.
module.js
(function() {
'use strict';
angular.module('operations.setup.holidays.calendar', []);
})();
Когда я пытаюсь ссылаться на него в одной директиве/сервис/контроллер работает нормально, но когда я пытаюсь ссылаться на него, скажем, директивы и службы, я получаю: Uncaught Error: [$injector:nomod] Module 'operations.setup.holidays.calendar' is not available!
directive.js(работает, если это единственное, что ссылки 'operations.setup.holidays.calendar'
)
(function() {
'use strict';
angular
.module('operations.setup.holidays.calendar')
.directive('yearlyCalendarDirective', yearlyCalendarDirective);
function yearlyCalendarDirective(){
return{
template: "<h1>Year Calendar Directive</h1>"
};
}
})();
service.js(добавляя что-то вроде этого вызывает указанную ошибку)
(function(){
'use strict';
angular
.module('operations.setup.holiday.calendar')
.service('Calendar',Calendar);
function Calendar(){
}
})();
Adding something like
.module('operations.setup.holiday.calendar',[])
gets rid of the error, but from what I understand this creates a new module instead of referencing the old one?
Edit: Вот является JSFiddle
У вас загруженный module.js перед вашими другими файлами? – devqon
@devqon Да, я думал, что это может быть проблемой, но module.js является первым загруженным. –