[我在每个组件中都有用作提供程序的服务:
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: (?, ?).
可以通过将服务用作根服务来解决,但是我需要单独的服务实例。