如何在ActivatedRoute中订阅url和params?

时间:2016-08-11 12:20:48

标签: angular

每当网址更改时,

activatedRoute.url.subscribe都会返回urlsegments的列表。每当activatedRoute.queryParams.subscribe发生变化时,queryParams都会返回 SELECT DISTINCT ch.Date,ID FROM dbo.tblrisk AS rk inner join (Select TableIdentity, [Date] from tblCommonHistory ) ch ON ch.TableIDentity = rk.ID order by ID 对象。

我如何订阅这两个,所以在回调中我可以访问最新的url和最新的params?

1 个答案:

答案 0 :(得分:0)

您可以使用fork join

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

请参阅:RxJs:forkJoin