我正在使用Anuglar 6
我有两个组件帐户
和个人资料
。 帐户组件已添加到应用程序组件中。
我想通过点击帐户组件中的按钮来打开个人资料组件。
但这给了我一个错误
Error: No component factory found for NgbModalBackdrop. Did you add it to @NgModule.entryComponents?
应用程序模块看起来像
@NgModule({
imports: [ BrowserModule, FormsModule ],
declarations: [ AppComponent, HelloComponent, AccountComponent, ProfileComponent ],
entryComponents: [
ProfileComponent
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
最佳答案
这是一个很大的模糊猜测,但您可能需要像这样在 app.module.ts 中导入 NgbModule
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
imports: [
NgbModule.forRoot()
]
})
这应该可以解决您遇到的错误。
关于angular - NgbModal 未从另一个组件中包含的组件打开模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53300365/