ocLazyLoad

{"id":"552d17dea86ee20d00780b89","name":"ocLazyLoad","subdomain":"oclazyload","versions":[{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"_id":"552d17dea86ee20d00780b8c","releaseDate":"2015-04-14T13:36:30.892Z"}],"current_version":{"version_clean":"1.0.0","version":"1.0"},"oauth":{"enabled":false},"api":{"name":"","url":"","contenttype":"form","auth":"","explorer":true,"proxyEnabled":true,"jwt":false,"headers":[],"authextra":[],"object_definitions":[]},"apiAlt":[],"plan_details":{"name":"Developer Hub","is_active":true,"cost":59,"versions":10000,"custom_domain":true,"custom_pages":true,"whitelabel":false,"errors":false,"password":true,"landing_page":true,"stylesheet":true,"javascript":false,"html":true,"extra_html":false,"admins":true},"intercom":"","intercom_secure_emailonly":false,"flags":{"allow_hub2":false,"hub2":false,"migrationRun":false,"oauth":false,"swagger":false,"correctnewlines":false,"speedyRender":false,"allowXFrame":false,"jwt":false,"hideGoogleAnalytics":false,"stripe":false,"disableDiscuss":false,"ssl":false,"autoSslGeneration":true,"cacheEnabled":true,"newApiExplorer":false,"newSearch":true},"asset_base_url":""}
  • Documentation
  • Support
    PopularNewestOpen

    General


    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 in  General  by  Pavan Malukuntla
    Thu Oct 03 2019 05:20:44 GMT+0000 (Coordinated Universal Time)
    686 views
    0 comments
    Lazy load routes

    My route.js file is getting bigger and bigger (8000 line until now!)

    Posted in  General  by  morteza
    Sat May 25 2019 08:33:15 GMT+0000 (Coordinated Universal Time)
    923 views
    1 comments
    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 in  General  by  Hector
    Tue Feb 19 2019 20:22:25 GMT+0000 (Coordinated Universal Time)
    924 views
    0 comments
    Lazy load each required controller after bundling all minified controllers

    I created a minified file with all controllers and named it as all.js, Now it has all controllers in it. Is there any way to add required controllers to this all.js file dynamically. Ex: initially all.js file should have only 'HomeCtrl', when i redirect to profile page, now all.js file should have 'ProfileCtrl' also. based on user actions all.js file should load required controllers in it. Thanks

    Posted in  General  by  sudheer mende
    Tue Nov 20 2018 20:59:09 GMT+0000 (Coordinated Universal Time)
    1,177 views
    0 comments
    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 in  General  by  Karthick
    Tue Sep 18 2018 05:27:09 GMT+0000 (Coordinated Universal Time)
    1,270 views
    0 comments
    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 in  General  by  lynn young
    Sun Feb 11 2018 10:15:57 GMT+0000 (Coordinated Universal Time)
    1,218 views
    2 comments
    Redirect state to otherwise after refresh page

    Hello... I create an issue on stackoverflow please read it, https://stackoverflow.com/questions/48238918/redirect-state-to-otherwise-after-refresh-page Thanks ... pls help :'(

    Posted in  General  by  Maher Ashori
    Sat Jan 13 2018 10:55:52 GMT+0000 (Coordinated Universal Time)
    914 views
    0 comments
    Dependency Injection not working properly

    My understanding of the dependency injection was that it would load all of the files and AFTER all of them are loaded and executed it would process the Javascript. At the moment i have some dependency injections but the code in my .directive on the module im loading is being run ahead of time. When i try to add code about the stuff being loaded in the .directive (not the link just before the return) I sometimes get an error saying that ex: React has not been loaded or whatever other source hasn't finished executing. angular.module('ocxGrid', [ ["../directives/ocx-grid/ocx-grid.min.css?version=" + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'jqueryUIMinimal/jquery-ui-1.10.4.custom.min.css?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'jqueryUIMinimal/jquery-ui-1.10.4.custom.min.js?version=' + window.ocxRouterVersion ], { files: [ window.ocxExternalDependenciesPath + 'react/react.development.js?version=' + window.ocxRouterVersion, //window.ocxExternalDependenciesPath + 'react/react.production.min.js?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'react/react-dom.development.js?version=' + window.ocxRouterVersion, //window.ocxExternalDependenciesPath + 'react/react-dom.production.min.js?version=' + window.ocxRouterVersion, window.ocxExternalDependenciesPath + 'react-tooltip/standalone/react-tooltip.min.js?version=' + window.ocxRouterVersion ], serie: true } ]) .directive('ocxGrid', ['utils', '$timeout', '$parse', '$ocLazyLoad', '$q', function(utils, $timeout, $parse, $ocLazyLoad, $q){ ; //This will insert here a concatenated version of all the files in components folder /* ocx file insert */ return { restrict: 'E', scope: { gridOptions:'=oaGridOptions' }, template: '<div></div>', link: function(p_scope, p_element, p_attrs){ ReactDOM.render(<OcxGrid options={p_scope.gridOptions}/>, p_element[0]); } }; }]);

    Posted in  General  by  Michael Pilote
    Tue Jan 09 2018 20:57:32 GMT+0000 (Coordinated Universal Time)
    1,031 views
    0 comments
    How to work with Lazy Load with Protractor

    At the moment I faced an issue when the project I am working with was refactored using ocLazy Load. From my side, I am an Automation QA working with Protractor v.5.1.2 . Before implementing above-mentioned feature I was successfully using protractor involving such option as browser.ignoreSynchronization = false; But now as the app downloads js bundles separately, protractor seems to recognize the end of Angular $http and $timeout tasks, when the first js bundle is loaded. Whereas the page still is not ready for further work, because it loads next js bundle and I am getting such errors like: No element found using locator I have also tried browser.waitForAngularEnabled(true); but this is basically the same as ignoreSynchronization if you see the source code . Such approaches might seem to be efficient browser.sleep(5000); or browser.isElementPresent(by.css('a[ui-sref="some.stateLink"]')); var $registerLink = element(by.css('a[ui-sref="some.stateLink"]')); expect($registerLink.getText()).toEqual('Register Now'); or var elem = by.css('a[ui-sref="some.stateLink"]'); browser.driver.wait(function() { return browser.isElementPresent(elem); }, 5000); var $registerLink = element(elem); expect($registerLink.getText()).toEqual('Register Now'); but they make tests fragile and there too much places in my code where I have to process it. Does anybody faced such a problem? Thank you.

    Posted in  General  by  Yevhen Batsiun
    Mon Sep 18 2017 15:15:50 GMT+0000 (Coordinated Universal Time)
    2,349 views
    0 comments
    rerun contents of lazylaoded file

    Hi, I have breakpoints in my lazyload file. It only gets hit on first load of the page. However, i have the lazyload directive set to run when certain buttons are clicked and its not happening. I need the contents to reload as the DOM has changed. Lazyload looks like this: (function () { 'use strict'; angular.module('lazyloadCtrl', ['filesService']) .controller('lazyloadCtrl', ['Files', '$ocLazyLoad', '$scope', '$rootScope', '$compile', function (Files, $ocLazyLoad, $scope, $rootScope,$compile) { $rootScope.$emit('initLazyLoad'); $rootScope.$on('initLazyLoad',function(event,args){ $ocLazyLoad.load( [{ name: 'Callout_Email', files: ['/scripts/services/lazyload.js'], rerun: true } ]) .then(function success(args) { $ocLazyLoad.load( [{ name: 'Callout_PeoplePicker', files: ['/scripts/services/sp.email.js'] } ]) .then(function success(args){ var temp = document.getElementsByClassName('scEmailLink'); angular.forEach(temp, function(value,key){ value.onclick = function(e){ angular.element('#peoplepickerElm' + key).toggle(); //console.log("Hooked into element: peoplepickerElm" + key); }; }, this); console.log("Callout_PeoplePicker success: " + args); }, function error(err){ console.log("Callout_PeoplePicker fail: " + err); }); return args; }, function error(err) { console.log("Callout_Email fail: " + err); console.log(err); return err; }); }); }]); }()); The contents of the files are not angular. They are SharePoint. And because the DOM has changed, i need them reloaded/reran, but when i run $rootScope.$emit('initLazyLoad'); from another part of my application, these files are not getting reloaded. Any suggestions? Thanks

    Posted in  General  by  Andy
    Wed Aug 23 2017 14:31:06 GMT+0000 (Coordinated Universal Time)
    1,114 views
    0 comments
    Loading a file with chunkhash with webpack (dynamic name)

    How can I implement of loading a file that has a changing chunkhash in it's name?Using webpack 3 and the new ui router. For example loading a user_management.84bd6a8d34d479d388a8.js.

    Posted in  General  by  Slava Roikhel
    Mon Aug 21 2017 10:40:40 GMT+0000 (Coordinated Universal Time)
    1,145 views
    0 comments
    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 in  General  by  Brian McG
    Wed Aug 02 2017 14:49:30 GMT+0000 (Coordinated Universal Time)
    1,307 views
    0 comments
    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 in  General  by  Lukus Reindl
    Tue Mar 28 2017 16:52:17 GMT+0000 (Coordinated Universal Time)
    1,324 views
    0 comments
    Empty Dependency module with dinamic loaded services and factories

    HI. I have some application that is module based and I have sahred module that includes the functionality not only for one module. So it is very big module and I don't want to give it's all functionality to client I want to lazy load it's functionality But after bootstraping main app The other modules I think remember shared module as empty and don't see it's services. Can some one help me? Am I doing something wrong??

    Posted in  General  by  Artur Gevorgyan
    Thu Mar 23 2017 06:46:04 GMT+0000 (Coordinated Universal Time)
    1,053 views
    1 comments
    How to load a controller on demand ?

    Posted in  General  by  Ramesh
    Sun Mar 05 2017 14:53:10 GMT+0000 (Coordinated Universal Time)
    1,161 views
    0 comments
    access to downloaded code as a text

    I have an idea to make i18n of JavaScript code on the fly. So I'd like to get source code of a file then to make substitution of words (phrases) and only after that to "make eval" of that code. Is it possible?

    Posted in  General  by  Alexander Levakov
    Sat Mar 04 2017 17:57:22 GMT+0000 (Coordinated Universal Time)
    964 views
    0 comments
    oclazyload + angularjs + ngroute + asp.net mvc

    I´m developing an application in asp.net mvc with angularjs and I need to lazy load some of my controllers, directives, services and so on. I´ve searched deeply on web and I found this js library to work with. so let see how my code are: 1 - LayoutPage (ASP.NET MVC) <html> <head> </head> <body ng-app="myAppUAI"> /*all my imports scripts are at the bottom of the page*/ <script type="text/javascript" src="..."></script> </body> </html> 2 - app.js var MyApp = angular.module("myAppUAI", ["ngProgress", "ngMaterial", "ngRoute", "oc.lazyLoad"]); MyApp.config(["$routeProvider", "$ocLazyLoadProvider" , function ($routeProvider, $ocLazyLoadProvider) { $routeProvider .when("/", { templateUrl: "/Main/Index", controller: "progressCircularController", resolve: { home: function ($ocLazyLoad) { return $ocLazyLoad.load(["/Scripts/AngularJS/Controllers/progressCircularController.js"]); } } }) .otherwise({ redirectTo: "/" }); $ocLazyLoadProvider.config({ debug: true, events: true }); }]); 3 - progressCircularController.js angular.module("myAppUAI").controller("progressCircularController", ["$rootScope", "$scope", function ($rootScope, $scope) { $scope.key = "Marcelo Bertinatto D´ Onofrio"; }]); 4 - in my view <div ng-controller="progressCircularController"> {{key}} </div> And finally, I´m getting a error in console like this: http://errors.angularjs.org/1.6.2/$controller/ctrlreg?p0=progressCircularController ocLazyLoad.fileLoaded scripts/AngularJS/Controllers/progressCircularController.js angular.js:14362 ocLazyLoad.componentLoaded ["myAppUAI", "register", "progressCircularController"] angular.js:14362 ocLazyLoad.moduleReloaded myAppUAI I've exhausted all my possibilities. Can you tell me what I´m doing wrong? Thanks in advance.

    Posted in  General  by  marcelo bertinatto
    Wed Feb 22 2017 22:06:28 GMT+0000 (Coordinated Universal Time)
    2,796 views
    0 comments
    All partials in app.js loading initially

    All partials in app.js loading initially time of page loading

    Posted in  General  by  Akash Edakkalathur
    Thu Feb 09 2017 14:44:06 GMT+0000 (Coordinated Universal Time)
    710 views
    0 comments
    Wait loading 1st file for loadgin second file with a router ?

    Hello, I want load file whan i call my state like this [code] .state('myState', { url: "/myUrl", templateUrl: "views/myView.html", controller: "myController", resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load({ name: 'myRoute', insertBefore: '#ng_load_plugins_before', files: [ 'provider/provider1.js', 'provider/provider2.js', 'provider/provider3.js', 'controler/mycontroller.js' ] // here todo Callback files for loader the second controller } //, Or here ? todo Callback files for loader the second controller ); }] } }) [/code]

    Posted in  General  by  W-prog
    Thu Feb 09 2017 10:48:36 GMT+0000 (Coordinated Universal Time)
    741 views
    0 comments
    How to create PRETTY URL on Oclazyload

    Posted in  General  by  Ngadiono CR
    Sat Jan 28 2017 00:05:00 GMT+0000 (Coordinated Universal Time)
    849 views
    0 comments
    • 1
    • 2
    • 3
    • 4
    Ask a Question

    Categories

    • All Categories
    • General
    readme.io
    Fork me on GitHub