I would like to use the ActivatedRoute service within another service. However, within my service the ActivatedRoute service is watching the main App component and none of route parameter changes are being emitted from the observable. If I instead watch the route parameters from within a component in the same module, the ActivatedRoute service functions as expected.
Here is a simplified version of my directory and it
app/
├──app.module.ts <- RouterModule Imported Here
├──app.component.ts
|
└──other-module/
├──other.module.ts <- other.service provided here
├──other.component.ts <- ActivatedRoute works as expected
└──other.service.ts <- ActivatedRoute watches App component
Here is a simplified version of my routes configuration:
export const routes: Routes = [
{ path: '', component: App },
{ path: 'other/:id', component: Other }
];
Could anyone provided some with how to properly handle and inject the services so that I can use the ActivatedRoute service from within another service.
Thanks.