Discussions
How to unload css、js by $ocLazyLoad.load(css/js file)
How to unload css、js by $ocLazyLoad.load(css/js file) when goto in another controller
Posted by luhaixing over 8 years ago
ocLazyLoad to load js and css files in all controllers
Is it possible to load js files and css files in all controller. please help anyone
Posted by Karthick over 5 years ago
How to use it with RequireJS?
I was using the 0.6.3 version and could easily carry angular dependencies, even after the bootstrap as in this example:
.state('intranet.AlterarCMSPublicacao', {
permissao: ['CMS', 'PUBLICACAO_ALTERAR'],
url: '/AlterarCMSPublicacao/:id', views: {
'content': angularAMD.route({
templateUrl: app.dir('modulos/CMS/Publicacao/views/alterar.tpl.html'),
controller: 'AlterarCMSPublicacaoController',
controllerAs: 'vm',
resolve: {
load: ['$ocLazyLoad', function($ocLazyLoad){
return $ocLazyLoad.load(['ckeditor','ng-ckeditor']);
}]
}
})
}
});
Now with version 1.0.8 I get the following error:
Object {_invokeQueue: Array[1], _configBlocks: Array[0], _runBlocks: Array[1], requires: Array[0], name: "ngCkeditor"}
What is the correct way to achieve the same result with the current version?
I'm using: ocLazyLoad.require.js
Posted by Leandro Carvalho Guimarães over 8 years ago
Lazy load routes
My route.js file is getting bigger and bigger (8000 line until now!)
Posted by morteza almost 5 years ago
Loading All Files In A Directory
I was wondering if its possible to specify a directory location rather than a set of files when loading modules?
For example:
/modules/module1.js
/modules/module2.js
...
Could I load all the modules in that directory?
Posted by Mike over 8 years ago
global config cache: false
There are a way to configure cache: false, in a global config, actually i enable that in every load({cache:false}) method
Posted by Hector about 5 years ago
Can I add defer attribute to the lazy loaded js files
I have lazy loaded the some js files. This scripts got added to my index html making them load before the dependent script files get loaded.
Ex: Before AngularJS Framework loads, my lazy loaded scripts are being executed.
Posted by Pavan Malukuntla over 4 years ago
Need to load templatecache JS file before hitting the routes so they load from templateCache
So I am using ng-templates to create a $templateCache so that I can server my html partials from the templateCache instead of making XHR requests for them. It will also allow us to browser cache the HTML partials.
Basically, ng-templates create a module for me like the one below;
angular.module('AngTemplates', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('/App/Anon/Test/LoginPartial.html',
"<div class=\"hero hero--xl fadeIn\"><div class=\"hero__inner\"></div>"
);
}
In my apps main module within its config block I am using the following to lazyload my templates module above
$ocLazyLoadProvider.config({
//debug: true,
modules: [{
events: true,
name: 'AngTemplates',
files: ['App/ang.templates.js']
}]
});
Now my issue is that within my $routeProvider, I am trying to do a resolve to load the module, so that that when the code hits my routes because my templateUrl's match those in the templateCache within my module it should load them from the templateCache as opposed to making an XHR request.
I can see the ang.templates.js file being loaded, however it seems like its either not being picked up or its too late in the process.
Is what I am trying to do possible with oclazyload?
Many thanks
Posted by Brian McG almost 7 years ago
How to config $ocLazyLoadProvider.config.modules.name in this situation than serval modules in the same files.
How to config $ocLazyLoadProvider.config.modules.name in this situation than serval modules in the same files.
For example,In Angular ui-grid. 'ui.grid', 'ui.grid.exporter', 'ui.grid.selection' those modules in the same file 'ui-grid.min.js'.I must config three modules have the same files but different names.Is there any way to config name like name:[ 'ui.grid', 'ui.grid.exporter', 'ui.grid.selection' ]?
Posted by lynn young about 6 years ago
Dependecy Injection from module directory
Is there a way I can use DI paths from the directory that the module is in instead of having to specify the path from the root of the domain?
Posted by Lukus Reindl about 7 years ago