ocLazyLoad
ocLazyLoad copied to clipboard
Load config after injection
I want to run a config method when lazy loading a module. After requesting and injecting my modules, my app loads a file with my config content which gets correctly (or not?) executed and updates the provider. But when I call the service in a controller it's like no config was made.
This is how plugins are loaded:
.state('scheduler', {
url: '/scheduler',
templateUrl: '/views/marketplace/scheduler.html',
controller: 'SchedulerCtrl',
resolve: {
loadScheduler: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load(['moment', 'scheduler']);
}]
}
});
{
name: 'moment',
insertBefore: '#loadJS',
files: ['/js/moment-with-locales.js']
},
{
name: 'scheduler',
insertBefore: '#loadJS',
serie: true,
files: ['/js/tmhDynamicLocale.js', '/js/ng-weekly-scheduler.js', '/js/scheduler.js']
}
Whereas my scheduler.js file referenced above:
angular.module('eXperting')
.config(['weeklySchedulerLocaleServiceProvider', function (localeServiceProvider) {
localeServiceProvider.configure({
doys: {'pt-br': 4},
lang: {'pt-br': {month: 'Mês', weekNb: 'Semana', addNew: 'Novo item'}},
localeLocationPattern: '/js/angular-locale_{{locale}}.js'
});
}]);
Finally, my controller declaration:
.controller('SchedulerCtrl', ['$scope', 'weeklySchedulerLocaleService', function ($scope, localeService)
I can make it work by importing the js files manually though
I'm having the same issue with hotkeysProvider, I couldn't lazy load it.