Javascript 使用angular 6 viewchild打开引导3.3.7模式
我的component.html中有一个引导模式,如下所示Javascript 使用angular 6 viewchild打开引导3.3.7模式,javascript,angular,typescript,twitter-bootstrap-3,angular6,Javascript,Angular,Typescript,Twitter Bootstrap 3,Angular6,我的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 #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>
我已经按照bootstrap 3.3.7文档在这个链接中访问了它
现在我得到一个错误如下。
this.myModall.nativeElement.modal不是函数。
关于如何从typescript文件访问模态并以正确的方式执行模态的任何建议????您是否可以使用错误的stackblitz链接,因为它应该可以工作?您使用的代码在哪里?抱歉,Rahul Singh,我无法将引导引用添加到stackblitz。请你添加我,给我那个链接,这样我就可以添加我的代码了。对不起,耽搁了。
export class Component implements OnInit, AfterViewInit {
@ViewChild('myModall') myModall: ElementRef;
ngAfterViewInit() {
this.myModall.nativeElement.modal('show');
}
}