1
1
/** @module ng2_directives */ /** */
2
- import { Directive , Output , EventEmitter } from "@angular/core" ;
2
+ import { Directive , Output , EventEmitter , ContentChild } from "@angular/core" ;
3
3
import { StateService } from "../../state/stateService" ;
4
4
import { UISref } from "./uiSref" ;
5
5
import { PathNode } from "../../path/node" ;
@@ -9,7 +9,7 @@ import {TargetState} from "../../state/targetState";
9
9
import { TreeChanges } from "../../transition/interface" ;
10
10
import { State } from "../../state/stateObject" ;
11
11
import { anyTrueR , tail , unnestR } from "../../common/common" ;
12
- import { UIRouterGlobals , Globals } from "../../globals" ;
12
+ import { Globals } from "../../globals" ;
13
13
import { Param } from "../../params/param" ;
14
14
import { PathFactory } from "../../path/pathFactory" ;
15
15
@@ -44,6 +44,7 @@ export class UISrefStatus {
44
44
45
45
// current statuses of the state/params the uiSref directive is linking to
46
46
@Output ( "uiSrefStatus" ) uiSrefStatus = new EventEmitter < SrefStatus > ( false ) ;
47
+ @ContentChild ( UISref ) sref : UISref ;
47
48
48
49
status : SrefStatus = {
49
50
active : false ,
@@ -54,12 +55,11 @@ export class UISrefStatus {
54
55
55
56
constructor ( transitionService : TransitionService ,
56
57
private _globals : Globals ,
57
- private _stateService : StateService ,
58
- public sref : UISref ) {
58
+ private _stateService : StateService ) {
59
59
this . _deregisterHook = transitionService . onStart ( { } , $transition$ => this . processTransition ( $transition$ ) ) ;
60
60
}
61
61
62
- ngOnInit ( ) {
62
+ ngAfterContentInit ( ) {
63
63
let lastTrans = this . _globals . transitionHistory . peekTail ( ) ;
64
64
if ( lastTrans != null ) {
65
65
this . processTransition ( lastTrans ) ;
0 commit comments