連結
https://valor-software.com/ngx-bootstrap/#/modals#directive-events
ngx-bootstrap > modals > Modal events
我想要使用directive-events 的事件讓modal關閉時作一些操作(一個modal內有3步驟,關閉時回到步驟1)
照範例只用一個可以成功使用
但想用一個以上modal的話
不知道該怎麼在ts定義另一個modal
這段 @ViewChild(ModalDirective, { static: false }) modal: ModalDirective;
export class DemoModalEventsComponent {
@ViewChild(ModalDirective, { static: false }) modal: ModalDirective;
messages: string[];showModal() {
this.messages = [];
this.modal.show();
}
handler(type: string, $event: ModalDirective) {
this.messages.push(
event ${type} is fired${$event.dismissReason ? ', dismissed by ' + $event.dismissReason : ''}
);
}
}