javascript - 打开带有 angular 6 viewchild 的 bootstrap 3.3.7 模态
问题描述
我的 component.html 中有如下引导模式,如下所示
<div #myModall class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
...
</div>
</div>
</div>
我正在访问它 component.ts 如下。
export class Component implements OnInit, AfterViewInit {
@ViewChild('myModall') myModall: ElementRef;
ngAfterViewInit() {
this.myModall.nativeElement.modal('show');
}
}
我已根据此链接 https://getbootstrap.com/docs/3.3/javascript/#modals中的 bootstrap 3.3.7 文档访问它 现在我收到如下错误。this.myModall.nativeElement.modal 不是函数。关于如何从打字稿文件访问模态并以正确的方式进行的任何建议??????
解决方案
推荐阅读
- row - Python读取多行并将它们写入ASCII文件中的一行
- csv - 文件 A 的输出行,其中第一列与文件 B 匹配
- reactjs - 我的商店有联合减速器。我的商店有很多状态变量。但我不想听特定变量的变化
- java - 从逗号分隔的字符串中删除并获取文本,如果它在java中具有#作为前缀?
- ios - iOS 发布构建问题
- reactjs - 如何在样式组件中使用 Typescript 自定义道具
- vb.net - 如何在 vb.net 代码中调用表单属性
- android - Android 预发布报告 - 显示崩溃但零问题
- google-signin - 具有不同 Firebase 项目的 Flutter Web 应用
- angularjs - BeanStalk 服务器中未显示图像