Navigate is a method of the Router class, which is mainly used to jump routes. Function definition:
1.this.router.navigate(['user', 1]); Jump from the root route as the starting point
2.this.router.navigate(['user', 1],{relativeTo: route}); The default value is the root route, which is an instance of ActivatedRoute
3.this.router.navigate(['user', 1],{ queryParams: { id: 1 } }); The route transmission parameter /user/1?id=1
4.this.router.navigate(['view', 1], { preserveQueryParams: true }); The default value is false, set to true, and the query parameter /user?id=1 to /view?id=1 in the previous route is retained
5.this.router.navigate(['user', 1],{ fragment: 'top' }); The anchor jump to /user/1#top
6.this.router.navigate(['/view'], { preserveFragment: true }); The default value is false, set to true, and keep the anchor /user/1#top to /view#top in the previous route
7.this.router.navigate(['/user',1], { skiplocatio{filter}nChange: true }); The default value is false, and the URL in the browser will remain the same when the route jumps to true, but the incoming parameters will still be valid
8.this.router.navigate(['/user',1], { replaceUrl: true }); If not set, it defaults to true, and if set to false, the route will not be redirected
|