1
- ; ( function ( window , undefined ) {
2
- 'use strict' ;
1
+ /**
2
+ * UI-Router Extras
3
+ * @version v0.0.9
4
+ * @link http://christopherthielen.github.io/ui-router-extras/
5
+ * @license MIT License, http://www.opensource.org/licenses/MIT
6
+ */
3
7
8
+ ( function ( window , angular , undefined ) {
4
9
angular . module ( "ct.ui.router.extras" , [ 'ui.router' ] ) ;
5
10
6
11
@@ -190,9 +195,10 @@ function inherit(parent, extra) {
190
195
$rootScope . $on ( "$stateChangeSuccess" , function ( event , toState , toParams , fromState , fromParams ) {
191
196
var deepStateStatus = computeDeepStateStatus ( toState ) ;
192
197
if ( deepStateStatus ) {
198
+ var name = toState . name ;
193
199
angular . forEach ( lastSubstate , function ( deepState , redirectState ) {
194
- if ( toState . name == deepState || toState . name . indexOf ( redirectState + "." ) != - 1 ) {
195
- lastSubstate [ redirectState ] = toState . name ;
200
+ if ( name == redirectState || name . indexOf ( redirectState + "." ) != - 1 ) {
201
+ lastSubstate [ redirectState ] = name ;
196
202
lastParams [ redirectState ] = angular . copy ( toParams ) ;
197
203
}
198
204
} ) ;
@@ -1129,7 +1135,13 @@ function debugViewsAfterSuccess($log, currentState, $state) {
1129
1135
// TODO: analyze this. I'm calling $urlRouter.sync() in two places for retry-initial-transition.
1130
1136
// TODO: I should only need to do this once. Pick the better place and remove the extra resync.
1131
1137
initPromise ( ) . then ( function retryInitialState ( ) {
1132
- $timeout ( function ( ) { $urlRouter . sync ( ) ; } ) ;
1138
+ $timeout ( function ( ) {
1139
+ if ( $state . transition ) {
1140
+ $state . transition . then ( $urlRouter . sync , $urlRouter . sync ) ;
1141
+ } else {
1142
+ $urlRouter . sync ( ) ;
1143
+ }
1144
+ } ) ;
1133
1145
} ) ;
1134
1146
}
1135
1147
init ( ) ;
@@ -1178,9 +1190,9 @@ function($rootScope, $state) {
1178
1190
get : function ( memoName ) {
1179
1191
return memoName ? memos [ memoName ] : previous ;
1180
1192
} ,
1181
- go : function ( memoName ) {
1193
+ go : function ( memoName , options ) {
1182
1194
var to = $previousState . get ( memoName ) ;
1183
- return $state . go ( to . state , to . params ) ;
1195
+ return $state . go ( to . state , to . params , options ) ;
1184
1196
} ,
1185
1197
memo : function ( memoName ) {
1186
1198
memos [ memoName ] = previous ;
@@ -1197,5 +1209,4 @@ angular.module('ct.ui.router.extras').run(['$previousState', function($previousS
1197
1209
// Inject $previousState so it can register $rootScope events
1198
1210
} ] ) ;
1199
1211
1200
-
1201
- } ( window ) ) ;
1212
+ } ) ( window , window . angular ) ;
0 commit comments