Angular router: how to replace param?
To navigate to particular link from current url, you can do something like this, constructor(private route: ActivatedRoute, private router: Router){} ngOnInit() { this.route.params.subscribe(params => { // PARAMS CHANGED .. let id = params[‘projectid’]; }); } navigate(){ this.router.navigateByUrl(this.router.url.replace(id, newProjectId)); // replace parameter of navigateByUrl function to your required url } On ngOnInit function, we have subscribed … Read more