ui-router ^1.x在ng1中使用state events
官网信息:https://ui-router.github.io/ng1/docs/latest/modules/ng1_state_events.html
Legacy state events
Polyfill implementation of the UI-Router 0.2.x state events.
The 0.2.x state events are deprecated. We recommend moving to Transition Hooks instead, as they provide much more flexibility, support async, and provide the context (the Transition, etc) necessary to implement meaningful application behaviors.
To enable these state events, include thestateEvents.jsfile in your project, e.g.,
<script src="stateEvents.js"></script>
and also make sure you depend on theui.router.state.eventsangular module, e.g.,
angular.module("myApplication", ['ui.router', 'ui.router.state.events'] ---------------------------------------------------------------------------------------------------
已知UI-Router在0.2.x中的state events在UI-Router1.x中被弃用,所以一定要手动引入stateEvents.js以及注入'ui.router.state.events';在于gulp构建的项目中:bower.json的"overrides"对向下添加
"angular-ui-router": {
"main": [
"release/angular-ui-router.js",
"release/stateEvents.min.js"
]
};
接着在app.run.json中就可以直接使用'$stateChangeStart'
=》
'use strict';
angular.module("myApp")
.run(['$rootScope', '$state','$location', function ($rootScope, $state, $location) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
console.log(toParams.t)
console.log(toParams.c)
$rootScope.accessToken = toParams.t
$rootScope.clientId = toParams.c
})
}])
原创;转载请标注!
ui-router ^1.x在ng1中使用state events的更多相关文章
- ngRoute 与ui.router区别
angular路由 路由 (route) ,几乎所有的 MVC(VM) 框架都应该具有的特性,因为它是前端构建单页面应用 (SPA) 必不可少的组成部分. 那么,对于 angular 而言,它自然也有 ...
- 【原创】ui.router源码解析
Angular系列文章之angular路由 路由(route),几乎所有的MVC(VM)框架都应该具有的特性,因为它是前端构建单页面应用(SPA)必不可少的组成部分. 那么,对于angular而言,它 ...
- AngularJS 使用 UI Router 实现表单向导
Today we will be using AngularJS and the great UI Router and the Angular ngAnimate module to create ...
- ngRoute 和 ui.router 的使用方法和区别
在单页面应用中要把各个分散的视图给组织起来是通过路由机制来实现的.本文主要对 AngularJS 原生的 ngRoute 路由模块和第三方路由模块 ui.router 的用法进行简单介绍,并做一个对比 ...
- [转]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 ...
- ASP.NET MVC搭建项目后台UI框架—8、将View中选择的数据行中的部分数据传入到Controller中
目录 ASP.NET MVC搭建项目后台UI框架—1.后台主框架 ASP.NET MVC搭建项目后台UI框架—2.菜单特效 ASP.NET MVC搭建项目后台UI框架—3.面板折叠和展开 ASP.NE ...
- iOS开发UI篇—在UITableview的应用中使用动态单元格来完成app应用程序管理界面的搭建
iOS开发UI篇—在UITableview的应用中使用动态单元格来完成app应用程序管理界面的搭建 一.实现效果 说明:该示例在storyboard中使用动态单元格来完成. 二.实现 1.项目文件结构 ...
- ng1中 如何用双向绑定 实现单向绑定的初始时不显示双括号效果?
ng1中 如何用双向绑定 实现单向绑定(ng-bind就可以不显示{{}})的初始时不显示双括号效果? AngularJS 实例 页面加载时防止应用闪烁: <div ng-app="& ...
随机推荐
- Spring学习(16)--- 基于Java类的配置Bean 之 基于泛型的自动装配(spring4新增)
例子: 定义泛型Store package javabased; public interface Store<T> { } 两个实现类StringStore,IntegerStore p ...
- 快速上手 Kotlin 的 11 招
本文转载自 Kotlin 公众号(KotlinX) 作者:bennyhuo 最近经常会收到一些 "用 Kotlin 怎么写" 的问题,作为有经验的程序员,我们已经掌握了一门或者多门 ...
- Vue 爬坑之路(四)—— 与 Vuex 的第一次接触
在 Vue.js 的项目中,如果项目结构简单, 父子组件之间的数据传递可以使用 props 或者 $emit 等方式 http://www.cnblogs.com/wisewrong/p/62660 ...
- ThreadLocal来管理事务
ThreadLocal (扩展) 1 ThreadLocal API ThreadLocal类只有三个方法: l void set(T value):保存值: l T get():获取值: l ...
- matplotlib.pyplot.hist
**n, bins, patches = plt.hist(datasets, bins, normed=False, facecolor=None, alpha=None)** ## 函数说明 用于 ...
- SQL Server数据类型有哪些
一. 整数数据类型 整数数据类型是最常用的数据类型之一. 1.INT (INTEGER) INT (或INTEGER)数据类型存储从-2的31次方 (-2 ,147 ,483 ,648) 到2的31次 ...
- django favicon配置
其实网站加一个图标,在/static/images/里面放置favicon.ico 1. 直接url里修改 from django.views.generic.base import Redirect ...
- python 标准库 -- subprocess
subprocess 主要功能室执行外部的命令和程序 一个进程可 fork 一个子进程, 并让这个子进程 exec 另外一个程序. 在 python 中, 可以通过标准库中的 subprocess 包 ...
- An express train to reveries
An express train to reveries time limit per test 1 second memory limit per test 256 megabytes input ...
- Winform Timer用法,Invoke在Timer的事件中更新控件状态
System.Timers.Timer可以定时执行方法,在指定的时间间隔之后执行事件. form窗体上放一个菜单,用于开始或者结束定时器Timer. 一个文本框,显示定时执行方法. public pa ...