所以,我创建了一个组件ExampleComponent和模块,在宣布它的心不是在app.module上市。接下来,我想声明组件ExampleComponent一个模块中被在app.module列出。我该怎么做呢?如果我简单地声明它,那么我会收到以下错误:组件ExampleComponent是由多个NgModule声明的。
abc.module.ts
import { ExampleComponent} from '../Example/Example.component';
@NgModule({
declarations: [
ExampleComponent
]
})
Run Code Online (Sandbox Code Playgroud)
app.module.ts
import { NewModule} from '../new/new.component';
@NgModule({
imports: [
NewModule
declarations: [
]
})
Run Code Online (Sandbox Code Playgroud)
新模块
import { ExampleComponent} from '../Example/Example.component';
@NgModule({
declarations: [
ExampleComponent
]
})
Run Code Online (Sandbox Code Playgroud)