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 は関数ではありません。TypeScript ファイルからモーダルにアクセスし、正しい方法で実行するにはどうすればよいでしょうか?