Angular 2 Activatedroute params not working in Service or outside

后端 未结 4 504
甜味超标
甜味超标 2021-02-01 03:36

I have a very strange problem: index.html


4条回答
  •  灰色年华
    2021-02-01 04:36

    The component added by the router gets the router segment (ActivatedRoute) passed, but in a service there is no activated route. You can subscribe to router.events and traverse the routes tree (router.firstChild...`) to get params out of a specific route sequement you need.

    See also https://github.com/angular/angular/issues/11023

提交回复
热议问题