Open ng-bootstrap modal programmatically

前端 未结 2 723
暖寄归人
暖寄归人 2020-12-15 19:42

I\'ve got an angular 4 page including a ng-bootstrap modal. My code looks like this.

foo.html

[...]
2条回答
  •  执笔经年
    2020-12-15 19:55

    from Angular 8 you should also pass static option: {static: false} in ViewChild

    import { ViewChild } from '@angular/core';
    
    @ViewChild('content', { static: false }) private content;
    
    constructor(private modalService: NgbModal) { }
    
    this.modalService.open(this.content);
    

提交回复
热议问题