How to subscribe to url and params in ActivatedRoute?

activatedRoute.url.subscribereturns a list urlsegmentswhen the URL changes. activatedRoute.queryParams.subscribereturns an object queryParamswhenever it changes.

How can I subscribe to both, so in the callback I can access both the last URL and the last parameters?

+4
source share
1 answer

You can use fork connection

 Observable.forkJoin(activatedRoute.url, activatedRoute.queryParams)
    .subscribe(( a, b ) => { both have resolved here });

See: RxJs: forkJoin

0
source

Source: https://habr.com/ru/post/1650914/


All Articles