I want to generalize my state code below to pass in a string to serve as an argument into load and that argument will be called module which is then parsed in load call for lazy loading. Simply adding a string will error because Angular thinks it is a provider and triggers an unknown provider exception.
How can I achieve this objective?
function load ($ocLazyLoad, $q, $stateParams, module){
var deferred = $q.defer();
try{
$ocLazyLoad.load(module).then(function(){
deferred.resolve();
});
}
catch (ex){
deferred.reject(ex);
}
return deferred.promise;
}
$stateProvider
.state('action', {
name: 'action',
url: "/actionitems",
resolve: {
loadDependencies: ['$ocLazyLoad', '$q', '$stateParams', load]
},
templateUrl: '/app/tool/action/ActionItems.html'
});