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

后端 未结 3 1191
走了就别回头了
走了就别回头了 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条回答
  •  旧时难觅i
    2021-01-20 18:39

    This will happen if something wrong was provided as a provider. And it is unlikely that there may be another reason for this.

    In one place it is ...shared/service/cert.service, and in another it is ...shared/Service/cert.service. Case matters. It depends on the environment what happens with these modules during build process, but this can cause errors, e.g. they may become duplicated and refer to different objects.

    To quickly debug this, CertService can be exposed from both files as window.CertService1 and window.CertService2 and compared in console if both are defined and equal.

提交回复
热议问题