2016-03-02 53 views
0

如何合并oc lazyload以与yeoman生成器一起工作,因为运行gulp会将所有依赖关系注入到脚本文件夹中。我如何配置oc lazyload来注入依赖关系?将oc lazyload与gulp-angular合并

回答

0

有你需要做的

  • 从删除依赖引用的index.html
  • 使用或者

    <div oc-lazy-load="['scripts/controllers/about.js', 'scripts/services/helloservice.js']"> 
        <div ng-controller="AboutCtrl as about"> 
         Your html goes here 
        </div> 
    </div> 
    
  • 或者你为每个项目添加依赖与路线一起多件事情可以在app.js文件中添加引用

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

我已经用Grunt代替Gulp实现了。但它是同样的。结帐我的文章。 https://routerabbit.com/blog/convert-angularjs-yeoman-spa-lazyload/

+0

事情是我在同一个项目中使用未来状态提供程序(https://christopherthielen.github.io/ui-router-extras/#/future),所以这些状态是实时创建的,我仍然需要检查它是否会按我期望的方式工作。谢谢你 。 – 32teeths

+0

让我知道这是行不通的。你可以在Github上创建一个小项目并发送给我URL。我会试验它。 – Dhiren