Skip to content

Commit

Permalink
fix(ng2.UISrefActive): Use @ContentChildren to query for the nested U…
Browse files Browse the repository at this point in the history
…ISref

Closes #2950
  • Loading branch information
christopherthielen committed Aug 31, 2016
1 parent 44dfdec commit 999c42a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ng2/directives/uiSrefStatus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @module ng2_directives */ /** */
import {Directive, Output, EventEmitter} from "@angular/core";
import {Directive, Output, EventEmitter, ContentChild} from "@angular/core";
import {StateService} from "../../state/stateService";
import {UISref} from "./uiSref";
import {PathNode} from "../../path/node";
Expand All @@ -9,7 +9,7 @@ import {TargetState} from "../../state/targetState";
import {TreeChanges} from "../../transition/interface";
import {State} from "../../state/stateObject";
import {anyTrueR, tail, unnestR} from "../../common/common";
import {UIRouterGlobals, Globals} from "../../globals";
import {Globals} from "../../globals";
import {Param} from "../../params/param";
import {PathFactory} from "../../path/pathFactory";

Expand Down Expand Up @@ -44,6 +44,7 @@ export class UISrefStatus {

// current statuses of the state/params the uiSref directive is linking to
@Output("uiSrefStatus") uiSrefStatus = new EventEmitter<SrefStatus>(false);
@ContentChild(UISref) sref: UISref;

status: SrefStatus = {
active: false,
Expand All @@ -54,12 +55,11 @@ export class UISrefStatus {

constructor(transitionService: TransitionService,
private _globals: Globals,
private _stateService: StateService,
public sref: UISref) {
private _stateService: StateService) {
this._deregisterHook = transitionService.onStart({}, $transition$ => this.processTransition($transition$));
}

ngOnInit() {
ngAfterContentInit() {
let lastTrans = this._globals.transitionHistory.peekTail();
if (lastTrans != null) {
this.processTransition(lastTrans);
Expand Down

0 comments on commit 999c42a

Please sign in to comment.