【发布时间】:2017-03-23 19:24:39
【问题描述】:
使用 Router V 3.0.0 我可以做到这一点
this.router.routerState.snapshot.root.queryParams["someParameter"];
但是我无法使用 Router V 3.4.10 实现相同的功能。
有什么想法吗?
【问题讨论】:
使用 Router V 3.0.0 我可以做到这一点
this.router.routerState.snapshot.root.queryParams["someParameter"];
但是我无法使用 Router V 3.4.10 实现相同的功能。
有什么想法吗?
【问题讨论】:
写入组件的构造函数
constructor(private router: Router,
private route: ActivatedRoute
) {
this.route.queryParams.forEach((params: Params) => {
let someParameter = params['someParameter'];
console.log(someParameter);
});
}
【讨论】: