March 2017
Intermediate to advanced
118 pages
2h 1m
English

So at this point the router has created a router state and instantiated the components. Next, we need to be able to navigate from this router state to another one. There are two ways to accomplish this: imperatively, by calling router.navigate, or declaratively, by using the RouterLink directive.
To navigate imperatively, inject the Router service and call navigate:
@Component({...}) class MessageCmp { public id: string; constructor(private route: ActivatedRoute, private router: Router) { route.params.subscribe(_ => this.id = _.id); } openPopup(e) { this.router.navigate([{outlets: {popup: ['message', this.id]}}]).then(_ ...Read now
Unlock full access