Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions dist/modules/ocLazyLoad.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
debug = false,
events = false,
moduleCache = [],
modulePromises = {};
modulePromises = {},
defaultScriptType = 'application/javascript';

moduleCache.push = function (value) {
if (this.indexOf(value) === -1) {
Expand All @@ -55,6 +56,10 @@
if (angular.isDefined(config.events)) {
events = config.events;
}

if (angular.isDefined(config.defaultScriptType)) {
defaultScriptType = config.defaultScriptType;
}
};

/**
Expand Down Expand Up @@ -441,6 +446,14 @@
return regModules;
},

/**
* Returns the default value to use for script type attribute
* @returns {string}
*/
getDefaultScriptType: function getModules() {
return defaultScriptType;
},

/**
* Let you check if a module has been loaded into Angular or not
* @param modulesNames String/Object a module name, or a list of module names
Expand Down Expand Up @@ -762,4 +775,4 @@
if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.exports === exports) {
module.exports = 'oc.lazyLoad';
}
})(angular, window);
})(angular, window);
3 changes: 2 additions & 1 deletion dist/modules/ocLazyLoad.loaders.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
break;
case 'js':
el = $window.document.createElement('script');
el.type = angular.isDefined(params.scriptType) ? params.scriptType : this.getDefaultScriptType();
el.src = params.cache === false ? cacheBuster(path) : path;
break;
default:
Expand Down Expand Up @@ -124,4 +125,4 @@
return $delegate;
}]);
}]);
})(angular);
})(angular);