ng-bootstrap 8.x.x 应该提示输入 entryComponents 吗?

Should ng-bootstrap 8.x.x be prompting for entryComponents?

我正在将 Angluar 应用程序从 v9.1.x 更新到 v10.2.x,随后将 ng-bootstrap 更新到 8.x.x。自从这样做以来,模式停止工作,并且我在浏览器控制台中收到一条错误消息,询问有问题的组件是否列为 entryComponent

这是预期的行为吗?据我了解,不再需要 Angular 9+ 中的 entryComponents,事实上,当我们使用 运行 Angluar v9.1.x 和 ng-bootstrap 时v6.x 我们不需要它。

这真的是一个是或否的问题,所以我不知道除了像这样的东西我还能提供什么调试代码:

@NgModule({
  declarations: [
    // components
  ],
  imports: [
    // imports
  ],
  providers: [
    // providers
  ],
  bootstrap: [AppComponent],
  entryComponents: [
    TestComponent // <-- this used to not be required by ng-bootstrap, and it not required by Angular 9x+
                  //     but any calls to NgbModal.open generate an error asking if the TestComponent is in the entry components
  ]
})
export class AppModule { }

我终于在文档中找到了答案——不知道我之前是怎么错过的。答案是肯定的——当你想打开一个以组件作为内容的模式时,该组件需要在你的 Angular 模块的 entryComponent 列表中。

You can pass an existing component as content of the modal window. In this case remember to add content component as an entryComponents section of your NgModule.

来源:https://ng-bootstrap.github.io/#/components/modal/examples#component

示例应用程序:https://stackblitz.com/edit/h7vehb--run?file=package.json

他们的示例应用程序是 运行 Angluar 10.x 和 ng-bootstrap 8.0