Recentlly works with AngularJS + ocLazyLoad, our project have break down into multi small modules. For example

mainApp module

| -- vendor module

| -- child 1 module

| -- child 2 module

| -- ....

'vendor, child1, child2' they are spreated npm modules.

'vendor' contains all the common used libs. Because we have multi AngularJS projects on going, vendor module is shared among all of them.

One problem I met when apply lazy loaded is that, for example, I want to lazy load Child1 module, any child 1 module contains a lib call angular-scroll which locates in vendor module. And mainApp Module doesn't use angular-scroll lib.

angular.module('Child1', ['duScroll'])

When I lazy load Child1, it reports error that:

'duScroll'Provider' is not found

Because Child1 doesn't have this lib included, this lib was included in vendor module, ocLazyLoad requires:

lazy loaded modules should contains all the dependencies code, unless the dependencies was already declare in main app module

So the solution to solve the problem is include 'duScroll' into mainApp module:

angular.module('mainApp', ['duScroll'])

[AngularJS] ocLazyLoad -- Lazy loaded module should contain all the dependencies code的更多相关文章

  1. angularjs ocLazyLoad分步加载js文件,angularjs ocLazyLoad按需加载js

    用angular有一段时间了,平日里只顾着写代码,没有注意到性能优化的问题,而今有时间,于是捋了捋,讲学习过程记录于此: 问题描述:由于采用angular做了网页的单页面应用,需要一次性在主布局中将所 ...

  2. [Angular Router] Lazy loading Module with Auxiliary router

    Found the way to handle Auxiliary router for lazy loading moudle and erge load module are different. ...

  3. AngularJS系统学习之Module(模块)

    本文源自:http://blog.csdn.net/woxueliuyun/article/details/50962645 学习之后略有所得, 来此分享.建议看原文. 模块是提供一些特殊服务的功能块 ...

  4. Angular2 - Starter - Routes, Route Resolver

    在基于Angualr的SPA中,路由是一个很重要的部分,它帮助我们更方便的实现页面上区域的内容的动态加载,不同tab的切换,同时及时更新浏览器地址栏的URN,使浏览器回退和前进能导航到历史访问的页面. ...

  5. [AngularJS] Lazy loading Angular modules with ocLazyLoad

    With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...

  6. AngularJS Providers 详解

    供应者(Providers) Each web application you build is composed of objects that collaborate to get stuff d ...

  7. Angularjs 异步模块加载项目模板

    ng-lazy-module-seed(Angularjs 异步模块加载项目模板) 相信做过SPA项目的朋友都遇到过这个问题:页面初始化时需要加载文件太大或太多了,许多文件加载后很可能不会运行到,这是 ...

  8. Angular-ui-router + oclazyload + requirejs实现资源随route懒加载

    刚开始用angularjs做项目的时候,我用的是ng-router,觉得加载并不好.所以就用了ui-router,考虑到在app上网页加载速度太慢,所以我就想到了用懒加载,看下是否能提升性能,提高加载 ...

  9. AngularJS基础总结

    w3shools    angularjs教程  wiki   <AngularJS权威教程> Introduction AngularJS is a JavaScript framewo ...

随机推荐

  1. spring3 上配置quartz 任务调度

    maven配置: <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>qu ...

  2. [Windows Server 2008] 搭建数据云备份

    ★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com ★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频. ★ 本节我们将带领大家:如何搭建数 ...

  3. LOL喷子专用自动骂人工具,2018更新完整版!

    软件截图 软件说明: 先进入游戏 打开程序 Z开启/C关闭 下载地址:密码 yjnm

  4. 【分享】iTOP-iMX6UL开发板驱动看门狗 watchdog 以及 Linux-c 测试例程

    iTOP-iMX6UL开发板看门狗测试例程,iTOP-iMX6UL 开发板的看门狗驱动默认已经配置,可以直接使用测试例程. 版本 V1.1:1.格式修改:2.例程修改完善,其中增加喂狗代码.1 看门狗 ...

  5. 迅为4418开发板Qt移植移动4G模块第二部分

    第一部分: http://www.cnblogs.com/topeet/p/6509248.html 第二部分: 5.ping不通域名一般是DNS没有设置对造成的.在etc下有一个文件resolv.c ...

  6. centos7 安装后,意外出现Please make your choice from above ['q' to quit | 'c' to continue | 'r' to refresh]

    安装完成centos7后出现如下提示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License informat ...

  7. asp 读取 另外一个带参数的asp文件(服务器不支持!放弃吧!骚年!)

    (服务器不支持!放弃吧!骚年!) 主要作用是为了分离数据库,灵感是这样的:收到json影响,把asp里的数据,用一个页面输出,然后用另外一个页面读取,这样就不用有数据库位置的烦恼了 代码 网上有很多, ...

  8. make、makefile

    http://blog.csdn.net/wed110/article/details/34853475 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows ...

  9. Django中使用多线程发送邮件

    1.settings.py 增加Email设置   #mail EMAIL_HOST = ‘smtp.gmail.com’                   #邮件smtp服务器 EMAIL_POR ...

  10. redis新特性

    摘自<redis 4.xcookbook> 从实例重启同步] 故障切换同步] 4.0之前从实例主键过期bug redis4新特性 Memory Command Lazy Free PSYN ...