Error: (SystemJS) Can't resolve all parameters for ActivatedRoute: (?, ?, ?, ?, ?, ?, ?, ?)

前端 未结 2 1958
情话喂你
情话喂你 2020-12-20 11:48

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).

相关标签:
2条回答
  • 2020-12-20 12:17

    Remove providers: [ActivatedRoute] from @Component() there is no need for that. RouterModule.forRoot() already provides everything that is required.

    0 讨论(0)
  • 2020-12-20 12:17

    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.

    0 讨论(0)
提交回复
热议问题