【发布时间】:2017-08-10 01:56:12
【问题描述】:
我按照这里给出的例子https://valor-software.com/ng2-bootstrap/#/modals
但是当我将模板放入我的 html 中时
<div class="modal fade" bsModal #staticModal="bs-modal" [config]="{backdrop: 'static'}"
tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
.........
.......
</div>
我的 app.module.ts 中也有以下条目
import { ModalModule } from 'ng2-bootstrap';
@NgModule({
imports: [ModalModule.forRoot(),...]
})
下面的消息出现了,我不确定我错过了什么
EXCEPTION: Uncaught (in promise): Error: Template parse errors:
There is no directive with "exportAs" set to "bs-modal" ("
</p-dialog>
<div class="modal fade" bsModal [ERROR ->]#staticModal="bs-modal" [config]="{backdrop: 'static'}"
tabindex="-1" role="dialog" aria-labell"): PreCheckComponent@80:32
Can't bind to 'config' since it isn't a known property of 'div'. ("
</p-dialog>
根据指导,我不必将任何内容导入到我的组件中
【问题讨论】:
-
使用组件打字稿文件代码更新您的帖子
-
我刚刚添加了一些代码,如果您希望我添加任何其他内容,请告诉我
-
查看我的答案。如果需要更多帮助,请告诉我
-
实际上我无法导入 ModalDirective,它给了我错误
标签: angularjs angular typescript angular2-template ng2-bootstrap