Closed kerrph closed 6 years ago
能否提供一个简约的版本,且描述重现的操作步骤。
已简约,自定义组件在路由的环境下出错。
?????
1.打开此链接 https://ngx-bootstrap-modal-1bkq49.stackblitz.io/#/demo
这个demo 展示的内容是你的github上的demo,只不过修改了自定义组建打开的环境,是嵌套了路由
这个问题是由于 Angular 的模块生命周期引起的,这的确是一个问题,目前你能解决的办法是在子模块加上:
BootstrapModalModule.forRoot({ container: document.body })
或者 entryComponents
的注册放在根目录,我会增加一个 BootstrapModalModule.forChild()
解决这一问题。
我试了一下加在子模块里面,正常弹框了。原来我是加在了app.module里面,结果一直卡在那个问题上,现在知道原因了。 非常感谢
https://stackblitz.com/edit/ngx-bootstrap-modal-1bkq49 之前和你说的那个Angular5问题, 我再现出来了,你看一下。