@@ -18,6 +18,7 @@ import IScope = angular.IScope;
1818import IInterpolateService = angular . IInterpolateService ;
1919import { TransitionService } from "../../transition/transitionService" ;
2020import { State } from "../../state/stateObject" ;
21+ import { UIRouter } from "../../router" ;
2122
2223/** @hidden */
2324function parseStateRef ( ref : string , current : string ) {
@@ -321,8 +322,8 @@ function $StateRefDynamicDirective($state: StateService, $timeout: ITimeoutServi
321322 * to both the <div> and <a> elements. It is important to note that the state
322323 * names/globs passed to ui-sref-active shadow the state provided by ui-sref.
323324 */
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 ) {
326327 return {
327328 restrict : "A" ,
328329 controller : [ '$scope' , '$element' , '$attrs' , '$timeout' ,
@@ -362,8 +363,12 @@ function $StateRefActiveDirective($state: StateService, $stateParams: Obj, $inte
362363 return deregister ;
363364 } ;
364365
366+ function updateAfterTransition ( trans ) { trans . promise . then ( update ) ; }
365367 $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+ }
367372
368373 function addState ( stateName : string , stateParams : Obj , activeClass : string ) {
369374 var state = $state . get ( stateName , stateContext ( $element ) ) ;
0 commit comments