Angular2 - Error: Can't resolve all parameters for IconService

前端 未结 6 997
南旧
南旧 2021-01-19 00:32

I\'ve been trying to switch my app over to AoT compilation and have been getting this error in the production environment when the app is loading (it works fine locally).

6条回答
  •  萌比男神i
    2021-01-19 01:13

    My issue was that I was inheriting from a base class, and I had decorated that base class with @Injectable. The inheriting class was the class that should have the @Injectable attribute, not the base class. It seems that when the compiler sees the @Injectable attibute, it checks to make sure all the properties in the constructor can be injected. If not, it's an error. I solved it by removing the @Injectable attibute from that class.

提交回复
热议问题