@@ -18,6 +18,7 @@ import IScope = angular.IScope;
18
18
import IInterpolateService = angular . IInterpolateService ;
19
19
import { TransitionService } from "../../transition/transitionService" ;
20
20
import { State } from "../../state/stateObject" ;
21
+ import { UIRouter } from "../../router" ;
21
22
22
23
/** @hidden */
23
24
function parseStateRef ( ref : string , current : string ) {
@@ -321,8 +322,8 @@ function $StateRefDynamicDirective($state: StateService, $timeout: ITimeoutServi
321
322
* to both the <div> and <a> elements. It is important to note that the state
322
323
* names/globs passed to ui-sref-active shadow the state provided by ui-sref.
323
324
*/
324
- let uiSrefActive = [ '$state' , '$stateParams' , '$interpolate' , '$transitions' ,
325
- function $StateRefActiveDirective ( $state : StateService , $stateParams : Obj , $interpolate : IInterpolateService , $transitions : TransitionService ) {
325
+ let uiSrefActive = [ '$state' , '$stateParams' , '$interpolate' , '$transitions' , '$uiRouter' ,
326
+ function $StateRefActiveDirective ( $state : StateService , $stateParams : Obj , $interpolate : IInterpolateService , $transitions : TransitionService , $uiRouter : UIRouter ) {
326
327
return {
327
328
restrict : "A" ,
328
329
controller : [ '$scope' , '$element' , '$attrs' , '$timeout' ,
@@ -362,8 +363,12 @@ function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $inte
362
363
return deregister ;
363
364
} ;
364
365
366
+ function updateAfterTransition ( trans ) { trans . promise . then ( update ) ; }
365
367
$scope . $on ( '$stateChangeSuccess' , update ) ;
366
- $scope . $on ( '$destroy' , < any > $transitions . onStart ( { } , ( trans ) => trans . promise . then ( update ) && null ) ) ;
368
+ $scope . $on ( '$destroy' , < any > $transitions . onStart ( { } , updateAfterTransition ) ) ;
369
+ if ( $uiRouter . globals . transition ) {
370
+ updateAfterTransition ( $uiRouter . globals . transition ) ;
371
+ }
367
372
368
373
function addState ( stateName : string , stateParams : Obj , activeClass : string ) {
369
374
var state = $state . get ( stateName , stateContext ( $element ) ) ;
0 commit comments