angular : $location & $state(UI router)的关系
次序:angular 的 location会先跑
$rootScope.$on("$locationChangeStart", function (scope, newUrl, oldUrl) {
log("$locationChangeStart from " + oldUrl)
log("$locationChangeStart to " + newUrl)
});
接着是 ui router $state
$rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
log("$stateChangeStart from " + fromState.name)
log("$stateChangeStart to " + toState.name)
});
log出来的结果是$stateChangeStart 的fromState 是空,这是router UI 的机制,一开始没有state 去到state是会detect到
router UI $state是监听 angular 的$location,如果之前的url 或 state是一样的就不会触发。
$location.hash()是用digest换url的
angular : $location & $state(UI router)的关系的更多相关文章
- angular 的ui.router 定义不同的state 对应相同的url
Angular UI Router: Different states with same URL? The landing page of my app has two states: home-p ...
- 【原创】ui.router源码解析
Angular系列文章之angular路由 路由(route),几乎所有的MVC(VM)框架都应该具有的特性,因为它是前端构建单页面应用(SPA)必不可少的组成部分. 那么,对于angular而言,它 ...
- ngRoute 与ui.router区别
angular路由 路由 (route) ,几乎所有的 MVC(VM) 框架都应该具有的特性,因为它是前端构建单页面应用 (SPA) 必不可少的组成部分. 那么,对于 angular 而言,它自然也有 ...
- ngRoute 和 ui.router 的使用方法和区别
在单页面应用中要把各个分散的视图给组织起来是通过路由机制来实现的.本文主要对 AngularJS 原生的 ngRoute 路由模块和第三方路由模块 ui.router 的用法进行简单介绍,并做一个对比 ...
- angularjs ngRoute和ui.router对比
ngRoute模块是angularjs自带的路由模块,ui.router是一个第三方路由模块,接下来将对两者进行一个对比: ng-router(angular-router.js) ng-view n ...
- angular ui.router 路由传参数
angular已经用了一段时间了,最近在做路由,做一下笔记. 路由跳转的时候进行穿参 ui.router方式 <a ui-sref="edit({id:5})"> 编辑 ...
- AngularJS 使用 UI Router 实现表单向导
Today we will be using AngularJS and the great UI Router and the Angular ngAnimate module to create ...
- [转]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 ...
随机推荐
- windows下Nodejs环境部署
前言 Nodejs是基于v8引擎的轻量级框架,其特点为事件驱动.非阻塞.单线程.异步回调等. Nodejs相对于其他运行在服务器端的语言,容易学习,使用方便. 本文将介绍windows下Nodejs的 ...
- bzoj1396
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1396 题目大意: 题解:后缀自动机,只出现一次,那么就是right值为1,那么对于一段1-- ...
- Python3基础 frozenset() 创建一个不可更改的集合
镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...
- 后端数据库使用 Bomb方案
不再需要阿里云进行部署: http://docs.bmob.cn/ios/faststart/index.html?menukey=fast_start&key=start_ios
- 云脉推出表格识别API接口可以自助接入
针对如今市场上对于海量票据信息的录入需求,近期厦门云脉技术有限公司推出票据识别相关的产品与服务,更是在云脉OCR SDK开发者平台上上线表格识别API接口,供广大开发者和集成商自助接入.为了降低财务系 ...
- centos 6.5下cmake工具的安装与配置
一.cmake是什么? CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程).他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C+ ...
- JAVA中获取当前运行的类名,方法名,行数
JAVA中获取当前运行的类名,方法名,行数 public static String getTraceInfo(){ StringBuffer sb = new StringBuffer(); Sta ...
- SQL语句中日期的计算方法大全
sql语句中的日期处理一.日期處理函數1.日期增減函數 dateadd(datepart,number,dtae) datepart:是規定應向日期的哪一部分返回新值的參數.下列是sql server ...
- 网站运维工具使用iis日志分析工具分析iis日志(iis日志的配置)
我们只能通过各种系统日志来分析网站的运行状况,对于部署在IIS上的网站来说,IIS日志提供了最有价值的信息,我们可以通过它来分析网站的响应情况,来判断网站是否有性能问题,或者存在哪些需要改进的地方 对 ...
- xmlns:xsi ——是指xml文件遵守xml规范,xsi全名:xml schema instance
http://blog.sina.com.cn/s/blog_4b6f8d150100nx3e.html http://blog.csdn.net/iaiti/article/details/4226 ...