[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 ...
随机推荐
- 上POJ刷题
Online Judge系统 Online Judge系统(简称OJ)是一个在线的判题系统.用户可以在线提交给定问题的多种程序(如C.C++.Pascal.Java)源代码,系统对源代码进行 ...
- 使用 reduce 实现数组 map 方法
//使用 reduce 实现数组 map 方法 const selfMap2 = function (fn, context){ let arr = Array.prototype.slice.cal ...
- JavaSE-17 泛型
学习要点 泛型接口 泛型类 泛型方法 多参数泛型类 泛型类的继承 泛型的定义 允许在定义类.接口.方法时使用类型形参,类型形参将会在声明变量.创建对象或者调用方法时候动态指定. 泛型接口 1 定义 ...
- BZOJ 3595: [Scoi2014]方伯伯的Oj Splay + 动态裂点 + 卡常
Description 方伯伯正在做他的Oj.现在他在处理Oj上的用户排名问题. Oj上注册了n个用户,编号为1-”,一开始他们按照编号排名.方伯伯会按照心情对这些用户做以下四种操作,修改用户的排名和 ...
- python类访问限制
1.类的访问限制:要让内部属性不被外部访问,可以把在属性的名称前加上两个下划线__,在Python中,实例的变量名如果以__开头,就变成了一个私有变量(private),只有内部可以访问,外部不能访问 ...
- (转载)C++ string中find() ,rfind() 等函数 用法总结及示例
string中 find()的应用 (rfind() 类似,只是从反向查找) 原型如下: (1)size_t find (const string& str, size_t pos = 0) ...
- 关于解决ssh的"Write failed: Broken pipe"问题
操作环境: 服务器:微软云 Linux CentOS 虚拟机 客户端:MAC OSX terminal 问题描述: 登录虚拟机短时间内不操作就会断开连接并报该“Write failed: Broken ...
- jar项目 BeanDefinitionParsingException: Configuration problem:Unable to locate Spring NamespaceHandler for XML schema namespace
最近由于项目需要,需要jar项目来处理. 我在项目中整合了Spring,在编辑器中启动没有问题,但是使用ant打包为一个完整jar文件,部署后启动报错如下 org.springframework.be ...
- stm32 调试时卡在LDR R0, =SystemInit
网上找到的可能的原因 堆栈空间默认的太小 默认startup_stm32f10x_hd.s中 Stack_Size EQU 0x00000400,如果改大之后,可能调试就可以正常运行. 出现最多的情况 ...
- 九度教程第22题——今年暑假不AC(看尽量多的电视节目)
#define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> #include <algorithm> using namespace ...