We've looked at lazy loading with ocLazyLoad previously, but what if we are using ui-router and want to lazy load modules when we change states?

angular.module("demo", ["ui.router", "oc.lazyLoad"])
.config(function ($stateProvider) {
$stateProvider.state('store', {
templateUrl: "store/store.html",
controller: "StoreCtrl as store",
resolve: {
store: function ($ocLazyLoad) {
return $ocLazyLoad.load(
{
name: "store",
files: ["store/store.js"]
}
)
}
}
})
}) .controller("AppCtrl", function ($state) {
var app = this;
app.click = function () {
$state.go("store")
}
})

[AngularJS] Lazy Loading modules with ui-router and ocLazyLoad的更多相关文章

  1. [AngularJS] Lazy loading Angular modules with ocLazyLoad

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

  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. [Angular2 Router] Lazy Load Angular 2 Modules with the Router

    Angular 2 lazy loading is a core feature of Angular 2. Lazy loading allows your application to start ...

  4. AngularJS 使用 UI Router 实现表单向导

    Today we will be using AngularJS and the great UI Router and the Angular ngAnimate module to create ...

  5. angularjs ngRoute和ui.router对比

    ngRoute模块是angularjs自带的路由模块,ui.router是一个第三方路由模块,接下来将对两者进行一个对比: ng-router(angular-router.js) ng-view n ...

  6. [转]AngularJS 使用 UI Router 实现表单向导

    本文转自:http://www.oschina.net/translate/angularjs-multi-step-form-using-ui-router 今天我们将使用AngularJs和伟大的 ...

  7. [转]AngularJS+UI Router(1) 多步表单

    本文转自:https://www.zybuluo.com/dreamapplehappy/note/54448 多步表单的实现   在线demo演示地址https://rawgit.com/dream ...

  8. angularJS ui router 多视图单独刷新问题

    场景:视图层级如下 view1 --view11 --view111 需求:view11的一个动作过后,单独刷新view12 解决方式:修改层级设计 view1 --view11 --view111 ...

  9. ngRoute 和 ui.router 的使用方法和区别

    在单页面应用中要把各个分散的视图给组织起来是通过路由机制来实现的.本文主要对 AngularJS 原生的 ngRoute 路由模块和第三方路由模块 ui.router 的用法进行简单介绍,并做一个对比 ...

随机推荐

  1. Win7远程登录Ubuntu14.04

    Quote: http://www.xp74.com/article/news/6083.htm Method: One:vnc连接,实现图形化登录 优点:图形化操作,较第二种方法快 缺点:效率不是最 ...

  2. 重新安装Photoshop CS6以后启动软件出现Licensing for this product has expired

    当我们卸载试用版本Photoshop CS6并且重新安装,出现Licensing for this product has expired,并且无法打开软件,这是由于证书过期导致的,解决办法是将计算机 ...

  3. HDU 5311

    把anniversary分成三个区间,分别枚举每个区间在给定模板中的长度.每次枚举完一个区间,记录下区间长度和起始坐标,下次从剩下长度开始枚举,避免重复. #include<iostream&g ...

  4. 转-CMMI在中国之混乱-CMMI比ISO9000会更惨

    CMMI在中国之混乱-CMMI比ISO9000会更惨 自己接触CMM/CMMI已经有8年时间了,现在静心回顾一下,觉得CMMI在中国的命运会比ISO9000还悲惨. 一组现象或许让你我对此结论有更深入 ...

  5. Hbase物理模型

    ​Hbase ​ 一种高可靠,面向列,可伸缩,事实读写的分布式数据库. 利用HDFS作为其文件存储系统. MapReduce处理数据. Zookeeper分布式协同服务. 数据结构 Row Key:行 ...

  6. Codeforces Educational Codeforces Round 15 A. Maximum Increase

    A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. UVa12657 - Boxes in a Line(数组模拟链表)

    题目大意 你有一行盒子,从左到右依次编号为1, 2, 3,…, n.你可以执行四种指令: 1 X Y表示把盒子X移动到盒子Y左边(如果X已经在Y的左边则忽略此指令).2 X Y表示把盒子X移动到盒子Y ...

  8. 第二百六十三天 how can I 坚持

    今天解脱了,放下了,小罗娜,不给力,话说下一步该咋办呢. 鱼不想过双十一自杀了.这都二十二号了,好快. 该把给罗娜说的那些话保存下来.可惜已经删了. 不知道做的对不对,反正就是没缘分,就这样吧. 睡觉 ...

  9. Nginx的session一致性问题

    session一致性memcached缓存数据库解决方案 1.安装memcached内存数据库 yum –y install memcached 可以用telnet localhost 11211 S ...

  10. Android实例-获取安卓手机WIFI信息(XE8+小米2)

    结果: 1.必须打开Access wifi state权限,不打开权限会出图二的错误. 相关资料: http://blog.csdn.net/lyf_lyf/article/category/1735 ...