0

How can I incorporate oc lazyload to work with gulp-angular yeoman generator , Since running gulp will inject all the dependencies in the scripts folder. How can I configure oc lazyload to inject the dependencies instead ?

32teeths
  • 1,469
  • 1
  • 15
  • 32

1 Answers1

0

There are multiple things you need to do

  • Remove references of dependencies from index.html
  • Add dependencies for each project along with route using either

    <div oc-lazy-load="['scripts/controllers/about.js', 'scripts/services/helloservice.js']">
        <div ng-controller="AboutCtrl as about">
             Your html goes here
        </div>
    </div>
    
  • Or you can add references in app.js file

    $ocLazyLoadProvider.config({
    modules: [{
          name: 'helloWorldApp.contact',
          files: ['scripts/controllers/contact.js', 
                  'scripts/services/contactservice.js']
          }]
    });
    

I have implemented the same with Grunt instead of Gulp. But it's alomst same. Checkout my article. https://routerabbit.com/blog/convert-angularjs-yeoman-spa-lazyload/

Dhiren
  • 592
  • 5
  • 16
  • The thing is that i am using Future State Provider (https://christopherthielen.github.io/ui-router-extras/#/future) in the same project , So that the states are created realtime , I still need to check if It will work the way i expect . Thanks to you . – 32teeths Apr 07 '16 at 14:24
  • Let me know if this doesn't work. You can create a small project on Github with that & send me URL. I will experiment with it. – Dhiren Apr 07 '16 at 15:35