无法为服务提供商解析所有参数吗?

问题描述 投票:0回答:1

[我在每个组件中都有用作提供程序的服务:

export class LayersSemanticService {
    constructor(
    private nMapLibrary: MapLibraryService,
    private linkService: LinkService
  ) {
  }
}

用作实例:

@Component({
  selector: "app-intersection-layer-component",
  templateUrl: "./intersection-layer-component.component.html",
  styleUrls: ["./intersection-layer-component.component.scss"],
  providers: [LayersSemanticService]
})

问题是我得到了这个错误:

compiler.js:2175 Uncaught Error: Can't resolve all parameters for LayersSemanticService: (?, ?).

可以通过将服务用作根服务来解决,但是我需要单独的服务实例。

angular angular6 angular8
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.