'No provider' error (even though I've added a provider)

后端 未结 3 1180
走了就别回头了
走了就别回头了 2021-01-20 18:18

I\'m trying to call a service from a particular class, but for some reason it can\'t be called, even though I am able to use it in other classes. I\'m using @Input

3条回答
  •  野的像风
    2021-01-20 18:40

    Exactly the same error message ("No provider for SomeService") can be triggered by having another service with the same name in your app. So it would look like you correctly included SomeService #1 in your module, added to the providers section, but it would still throw you the error. It puzzled me until I realized that there's SomeService #2 being imported in one of my components.

提交回复
热议问题