Skip to content

Instantly share code, notes, and snippets.

@slavafomin
Last active July 4, 2017 10:24
Show Gist options
  • Save slavafomin/dc53ae995a449e13807217ae0b582c27 to your computer and use it in GitHub Desktop.
Save slavafomin/dc53ae995a449e13807217ae0b582c27 to your computer and use it in GitHub Desktop.
@Component()
export class SomeComponent implements AfterViewInit {
@ViewChild(RouterOutlet)
outlet: RouterOutlet;
ngAfterViewInit (): void {
if (this.outlet.isActivated) {
this.doSomethingWithComponent(this.outlet.component);
}
this.outlet.activateEvents
.subscribe(component => this.doSomethingWithComponent(component))
;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment