2021年5月3日星期一

Convert ActivatedRoute.queryParams to Promise

I don't want to subscribe to route.queryParams as an Observable but want to make it a Promise to be able to use async/await to do various function calls in ngOnInit. Unfortunately I fail at this intention. The following implementation gives me no reaction or output:

constructor(private route: ActivatedRoute) { }      async ngOnInit() {      this.route.queryParams.toPromise().then(res => {        console.log(res);      });    }    

What am I doing wrong? Thx!

https://stackoverflow.com/questions/67376535/convert-activatedroute-queryparams-to-promise May 04, 2021 at 06:24AM

没有评论:

发表评论