Angular cli 2 Error Can't resolve all parameters for XXXXX by AOT build

前端 未结 1 1815
长发绾君心
长发绾君心 2021-01-22 20:32
            import { Injectable, Inject } from \'@angular/core\';
            import { Subject } from \"rxjs/Subject\";
            import { CompleterData, CompleterItem         


        
1条回答
  •  没有蜡笔的小新
    2021-01-22 21:04

    You will have to add @Inject so that its dependency can be resolved.

    So for custom services inside your service Inject its dependency with @Inject

    In your code replace your custom services with

    @Inject(ProgramService) private programService: ProgramService, @Inject(CacheService) private cacheService: CacheService,
    

    You can understand it deeply from this blog. https://blog.thoughtram.io/angular/2015/09/17/resolve-service-dependencies-in-angular-2.html

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