[AngularJS] ocLazyLoad -- Lazy loaded module should contain all the dependencies code
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的更多相关文章
- angularjs ocLazyLoad分步加载js文件,angularjs ocLazyLoad按需加载js
用angular有一段时间了,平日里只顾着写代码,没有注意到性能优化的问题,而今有时间,于是捋了捋,讲学习过程记录于此: 问题描述:由于采用angular做了网页的单页面应用,需要一次性在主布局中将所 ...
- [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. ...
- AngularJS系统学习之Module(模块)
本文源自:http://blog.csdn.net/woxueliuyun/article/details/50962645 学习之后略有所得, 来此分享.建议看原文. 模块是提供一些特殊服务的功能块 ...
- Angular2 - Starter - Routes, Route Resolver
在基于Angualr的SPA中,路由是一个很重要的部分,它帮助我们更方便的实现页面上区域的内容的动态加载,不同tab的切换,同时及时更新浏览器地址栏的URN,使浏览器回退和前进能导航到历史访问的页面. ...
- [AngularJS] Lazy loading Angular modules with ocLazyLoad
With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...
- AngularJS Providers 详解
供应者(Providers) Each web application you build is composed of objects that collaborate to get stuff d ...
- Angularjs 异步模块加载项目模板
ng-lazy-module-seed(Angularjs 异步模块加载项目模板) 相信做过SPA项目的朋友都遇到过这个问题:页面初始化时需要加载文件太大或太多了,许多文件加载后很可能不会运行到,这是 ...
- Angular-ui-router + oclazyload + requirejs实现资源随route懒加载
刚开始用angularjs做项目的时候,我用的是ng-router,觉得加载并不好.所以就用了ui-router,考虑到在app上网页加载速度太慢,所以我就想到了用懒加载,看下是否能提升性能,提高加载 ...
- AngularJS基础总结
w3shools angularjs教程 wiki <AngularJS权威教程> Introduction AngularJS is a JavaScript framewo ...
随机推荐
- webstorm快捷键大全-webstorm常用快捷键
默认配置下的常用快捷键,提高代码编写效率,离不开快捷键的使用,Webstorm拥有丰富的代码快速编辑功能,你可以自由配置功能快捷键. Webstorm预置了其他编辑器的快捷键配置,可以点击 查找/代替 ...
- Okhttp3发送xml、json、文件的请求方法
1.引入依赖 <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okht ...
- Goldengate完成Mysql到Mysql的数据同步
文档参考地址:http://blog.csdn.net/u010587433/article/details/49305019 需求: 使用Goldengate完成Mysql到Mysql的数据同步,源 ...
- 所有的工作目录 都要svn_开头,并且要进行svn同步,你能保证你不删除,你保证不了非你!
所有的工作目录 都要svn_开头,并且要进行svn同步,你能保证你不删除,你保证不了非你! 血的代价啊~
- 11-3 re模块
目录 r 的作用 re模块的常用功能 findall search match split sub 将数字替换成'H' subn 将数字替换成'H',返回元组(替换的结果,替换了多少次) compil ...
- GCC编译链接过程
编译链接过程 代码 #cat main.c #include <stdio.h> int add(int x, int y); int sub(int x, int y); int mul ...
- SqlSever锁及存储过程优化
SqlSever锁及存储过程优化 SQL server的所有活动都会产生锁.锁定的单元越小,就越能提高并发处理能力,但是管理锁的开销越大.如何找到平衡点,使并发性和性能都可接受是SQL Server的 ...
- vs2008如何新建自己工程的环境变量(局部)和 Windows系统(全局). .
在vs2008的Project->Property设置里经常会看到类似$(IntDir).$(OutDir).$(ProjectName) 的预定义宏.以vc2008为例,有时候我们在引用别的库 ...
- php更改wampserver的站点目录
我都wampserver安装在f盘 F:\wamp\bin\apache\Apache2.4.4\conf文件夹下的hhtpd.conf文件ctrl+f查找DocumentRoot,第二次的位置修改即 ...
- Android Bitmap详细介绍(3)
package com.testbitmapscale; import java.io.File; import java.io.FileInputStream; import java.io.Fil ...