service代码如下import { Injectable } from '@angular/core';import { FatherModule } from './father/father.module'@Injectable({
providedIn: FatherModule
})export class InnerService { constructor() { }
sayHello(){ console.log('good morning')
}
}father.module.ts代码如下import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';import { FatherComponent } from './father.component'import { SonComponent } from '../son/son.component'@NgModule({
declarations: [
SonComponent
],
imports: [
CommonModule
],
providers:[]
})export class FatherModule { }出现了如下错误 StaticInjectorError(Platform: core)[FatherComponent -> InnerService]:
NullInjectorError: No provider for InnerService!
at
添加回答
举报
0/150
提交
取消