I\'m trying to inject ActivatedRoute component into my component to access the ID of the object I\'m editing (or to find out, there\'s no ID param, new object is created).
Remove providers: [ActivatedRoute]
from @Component()
there is no need for that. RouterModule.forRoot()
already provides everything that is required.
To extend @günter-zöchbauer's answer. Make sure that you added RouterModule
to property exports
of @NgModule
. Directives/pipes/modules specified in exports
will be
used within the template of any component that is part of an Angular module that imports this Angular module.
i.e. in all child components of the module.