Uncaught (in promise): Error: StaticInjectorError(AppModule)[options]

后端 未结 8 1704
借酒劲吻你
借酒劲吻你 2020-12-01 14:08

I have a strange error. Usually (I did my googling), in this case of errors Angular specifies in square brackets which exactly module/service/provider/etc caused the problem

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 14:17

    Faced the same error. In my case , what i did wrong was that i injected the service(named DataService in my case) inside the constructor within the Component but I simply forgot to import it within the component.

     constructor(private dataService:DataService ) {
        console.log("constructor called");
      }
    

    I missed the below import code.

    import { DataService } from '../../services/data.service';
    

提交回复
热议问题