Skip to content

Instantly share code, notes, and snippets.

@stevermeister
Created June 3, 2017 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevermeister/ee9fdca12fd3895a1c9d19e8eb2c8de3 to your computer and use it in GitHub Desktop.
Save stevermeister/ee9fdca12fd3895a1c9d19e8eb2c8de3 to your computer and use it in GitHub Desktop.
export class TestComponent {
constructor(private route: ActivatedRoute, private router: Router) { }
ngOnInit() {
this.route.params.subscribe(console.log);
this.route.queryParams.subscribe(console.log);
this.route.fragment.subscribe(console.log);
this.route.data.subscribe(console.log);
this.route.url.subscribe(console.log);
this.router.events.subscribe(console.log);
}
ngOnDestroy() {
// You should unsubscribe from each observable here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment