Angular 2 get routeParams in a service

前端 未结 6 503
情话喂你
情话喂你 2021-01-02 05:58

I want to shift the logic from component to service. But I found out that I can\'t get the routeParams in a service.

My component looks like

import {         


        
6条回答
  •  臣服心动
    2021-01-02 06:35

    I worked with @juansb827 answer and I got it to work when I got rid of the event filter and went directly for the traversal of that ActiveRoute. It worked for me. It's possible that, in my case, that event already happened by the time the service was being executed because my traversal was in a different method in my service.

提交回复
热议问题