Skip to content

Commit c590579

Browse files
author
Olivier Combe
committed
fix: allow $ocLazyLoadProvider.config to be called multiple times
Fixes #43
1 parent 12bc6b2 commit c590579

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/ocLazyLoad.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,17 +463,24 @@
463463
}];
464464

465465
this.config = function(config) {
466-
jsLoader = config.jsLoader || config.asyncLoader;
467-
468-
if(angular.isDefined() && !angular.isFunction(jsLoader)) {
469-
throw('The js loader needs to be a function');
466+
if(angular.isDefined(config.jsLoader) || angular.isDefined(config.asyncLoader)) {
467+
if(!angular.isFunction(jsLoader)) {
468+
throw('The js loader needs to be a function');
469+
}
470+
jsLoader = config.jsLoader || config.asyncLoader;
470471
}
471472

472473
if(angular.isDefined(config.cssLoader)) {
474+
if(!angular.isFunction(cssLoader)) {
475+
throw('The css loader needs to be a function');
476+
}
473477
cssLoader = config.cssLoader;
474478
}
475479

476480
if(angular.isDefined(config.templatesLoader)) {
481+
if(!angular.isFunction(templatesLoader)) {
482+
throw('The template loader needs to be a function');
483+
}
477484
templatesLoader = config.templatesLoader;
478485
}
479486

0 commit comments

Comments
 (0)