1、不带参数
this.router.navigate(['/custom']);
2、带参数跳转
const params: any = this.validateForm.value;
this.router.navigate(['/custom', params]);
// custom模块接收参数
// 第一种方式
this.router.snapshot.params;
// 第二种方式
this.router.params.subscribe((params) => {
this.params = params;
});
this.router.navigate(['/custom'], { queryParams: params});
// custom模块接收参数
this.router.snapshot.queryParams
3、隐藏路由和参数跳转
// skipLocationChange: true 默认为false 不会把新状态记入历史
this.router.navigate(['/custom'], {queryParams: params, skipLocationChange: true});