Reputation: 3854
I'm using ngx-bootstrap/modal
import { BsModalRef, BsModalService, ModalOptions } from 'ngx-bootstrap/modal';
constructor(private modalService: BsModalService) {}
this.modalService.show(this.Content, { ariaLabelledBy: 'modal-basic-title', keyboard: false, backdrop: 'static', }).result.then((result: LinkDetail) => {
Here i'm getting
Property 'result' does not exist on type 'BsModalRef'
any solution to fix this issue because i want to execute some lines of code after modal is fully loaded
thanks
Upvotes: 1
Views: 90
Reputation: 46
I believe is this is what you are looking for. You could use (onShown) hook to do something in your code.
https://valor-software.com/ngx-bootstrap/#/components/modals?tab=overview#service-events
https://valor-software.com/ngx-bootstrap/#/components/modals?tab=overview#directive-events
Upvotes: 0
Reputation: 57721
I think the open is synchronous and there is no need to wait for any promise. I checked the source code for show method.
You can simply put the logic inside a setTimeout, which will happen after the modal opens.
import { BsModalRef, BsModalService, ModalOptions } from 'ngx-bootstrap/modal';
constructor(private modalService: BsModalService) {}
this.modalService.show(this.Content, { ariaLabelledBy: 'modal-basic-title', keyboard: false, backdrop: 'static', });
setTimeout(() => {
// write your logic here!
});
Upvotes: 1