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 ...
随机推荐
- bzoj2152
题解: 随便点分治,用一个t数组,t[i]代表有u到root的值mod3==i: 那么答案就是:t[0]*t[0]+t[1]*t[2]*2; 代码: #include<iostream> ...
- Unity中使用多构造函数
如果要实例化的类只有一个构造函数, 则使用方法很简单使用方法如下: 1 2 3 4 5 6 7 using (IUnityContainer container = new UnityContaine ...
- Python3基础 在print中用 %d 输出一个整数
镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...
- 汇编语言实现led灯的跑马灯
led实验1.看原理图 看设备工作的原理(可能需要阅读芯片手册),看设备与cpu的连接关系 GPIO具有输入输出功能.输入:cpu想知道io引脚是高电平还是低电平那么就是输入方式输出:cpu想控制io ...
- 国民身份证号码校验之“C#/Winform方法实现+案例分析”
根据[中华人民共和国国家标准 GB 11643-1999]中有关公民身份号码的规定,公民身份号码是特征组合码,由十七位数字本体码和一位数字校验码组成.排列顺序从左至右依次为:六位数字地址码,八位数字出 ...
- js原生设计模式——2面向对象编程之闭包1
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- js动态控制table的tr,td增加及删除
html: <table id='wifi_clients_table' class="table table-striped table-bordered table-hover ...
- 报错找不到jquery-1.10.2.min.map解决办法
http://fruithardcandy.iteye.com/blog/1941452
- C++中的RAII技法
Resource Acquisition Is Initialization or RAII, is a C++ programming technique which binds the life ...
- Spring aop:decare-parent 为类增加新的方法
Spring aop:decare-parent 为类增加新的方法: 使用XML配置的方式: XML: <?xml version="1.0" encoding=" ...