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!



Read more here: https://stackoverflow.com/questions/67376535/convert-activatedroute-queryparams-to-promise

Content Attribution

This content was originally published by user.src at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: