直接看代码
- 跳转时带上参数
import { Router } from '@angular/router'
get route() {
return this.injector.get(Router);
}
this.route.navigate([`admin/orgDashboard/device-repaire`, { type: this.form.data.type, val: this.form.data.val }]);
- 在目标页获取参数
import { ActivatedRoute } from '@angular/router'
get activeRoute() {
return this.injector.get(ActivatedRoute);
}
this.activeRoute.snapshot.paramMap.get('type')
this.activeRoute.snapshot.paramMap.get('val')
这是一份总结。自己手敲一遍记忆更深。
希望对你有帮助。