[AngularJS] Lazy Loading modules with ui-router and ocLazyLoad
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的更多相关文章
- [AngularJS] Lazy loading Angular modules with ocLazyLoad
With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...
- [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. ...
- [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 ...
- AngularJS 使用 UI Router 实现表单向导
Today we will be using AngularJS and the great UI Router and the Angular ngAnimate module to create ...
- angularjs ngRoute和ui.router对比
ngRoute模块是angularjs自带的路由模块,ui.router是一个第三方路由模块,接下来将对两者进行一个对比: ng-router(angular-router.js) ng-view n ...
- [转]AngularJS 使用 UI Router 实现表单向导
本文转自:http://www.oschina.net/translate/angularjs-multi-step-form-using-ui-router 今天我们将使用AngularJs和伟大的 ...
- [转]AngularJS+UI Router(1) 多步表单
本文转自:https://www.zybuluo.com/dreamapplehappy/note/54448 多步表单的实现 在线demo演示地址https://rawgit.com/dream ...
- angularJS ui router 多视图单独刷新问题
场景:视图层级如下 view1 --view11 --view111 需求:view11的一个动作过后,单独刷新view12 解决方式:修改层级设计 view1 --view11 --view111 ...
- ngRoute 和 ui.router 的使用方法和区别
在单页面应用中要把各个分散的视图给组织起来是通过路由机制来实现的.本文主要对 AngularJS 原生的 ngRoute 路由模块和第三方路由模块 ui.router 的用法进行简单介绍,并做一个对比 ...
随机推荐
- 仿it快播顶部button点击背景滑动切换的效果
最近在it快播中看见它顶部的几个button可以点击后 背景会滑动到相应的button后面 就得很好看 就想办法实现了那效果 思路 大概就是通过view的叠加 把3个button通过RelativeL ...
- ASP.NET中常用的字符串分割函数
asp.net字符串分割函数用法 先来看个简单的实例 但是其数组长度却是25,而不是3.下面这种方法是先将“[111cn.net]”替换成一个特殊字符,比如$,在根据这个字符执行Split 例如下面我 ...
- SqlServer中输出错误消息
raiserror('所有参数都不能为空',16,1,@@error)
- cocos2d-x 详解之 CCTexture2D(纹理图片)和 CCTextureCache(纹理缓存)
精灵和动画都涉及到纹理图片的使用,所以在研究精灵与动画之前,我们先来了解一下纹理图片类CCTexture2D和纹理缓存CCTextureCache的原理: 当一张图片被加载到内存后,它是以纹理的形式存 ...
- 通过库函数API和C代码中嵌入汇编代码剖析系统调用的工作机制
作者:吴乐 山东师范大学<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 本次实验的主要内容就是分别采用A ...
- [Hive - LanguageManual] Hive Concurrency Model (待)
Hive Concurrency Model Hive Concurrency Model Use Cases Turn Off Concurrency Debugging Configuration ...
- The solution to Force.Com IDE 29.0 PassWord Problem
我最近使用Force.com IDE 时,经常提示密码错误.从Google 中终于发现一个解决方法,分享给大家,以供大家参考. 在Force.com IDE 29.0中,IDE 存储我们开发Org ...
- [转载] I wish you enough
几天前,我在机场无意中听到一对父女告别时最后一刻的对白.广播员已经通知大家准备登机了.他们站在安检口旁边紧紧拥抱,父亲对女儿说:“我爱你,希望你一切都充足!” 女儿回答:“爸爸,我是那么满足我们在一起 ...
- homework-05 GoldNumberServer
作业要求 这次作业要求实现一个黄金数游戏服务器,游戏流程如下,每个client向服务器提交一个有理数,服务器接收到所有客户端的提交后计算这些数字的平均数,再将其乘以黄金分割得到一个GoldNumber ...
- Android问题-打开DelphiXE8与DelphiXE10编译空工程提示“[Exec Error] The command exited with code 1.”
问题情况:开发了半天的D2007代码,想测试一个安桌程序,发现新建空工程,提示失败. 提示如下 Exec Error] The command PATH C:\Program Files (x86)\ ...