This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13043|Reply: 1

[Angular] Route jump to Navigate in angular2 router

[Copy link]
Posted on 10/19/2018 3:07:08 PM | | |
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





Previous:insertBefore method, and how to implement the insertAfter method
Next:BonusCloud Activation Code Grab Tool [with Source Code]
Posted on 10/22/2018 2:01:42 PM |
learned
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com