如何从 angular 5 中的查询字符串中读取值?
How do I read the values from query string in angular 5?
如何从 angular 5
中的查询字符串中读取值
在您的组件中,您可以使用 ActivatedRoute 访问查询参数。
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.queryParams.subscribe(params => {
console.log(params['id']); // 13467tdgbgfhjfgy
});
}
如何从 angular 5
中的查询字符串中读取值在您的组件中,您可以使用 ActivatedRoute 访问查询参数。
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.queryParams.subscribe(params => {
console.log(params['id']); // 13467tdgbgfhjfgy
});
}