Dismiss manually doesn't work
See original GitHub issueHi, I’m using ngx-smart-modal in an Angular 6/RxJs application to display a confirm dialog. The problem is that it seems you can create just one button, the ‘close’ button, that triggers myModal.close(). So, I thought I could add two buttons to allow the user to confirm or cancel the modal. CANCEL BUTTON:
<button (click)="confirmModal.dismiss()" type="button">{{confirmModal.getData().cancelBtnLabel}}</button>
CONFIRM BUTTON:
<button (click)="confirmModal.close(true)" type="button">{{confirmModal.getData().confirmBtnLabel}}</button>
And then the component where there is the button to open the modal:
openConfirmModal() {
const confirmModalData: Object = {
...
};
this.ngxSmartModalService.setModalData(confirmModalData, 'confirmModal');
let confirmModalRef = this.ngxSmartModalService.getModal('confirmModal');
confirmModalRef.onDismiss.subscribe(() => {
....
});
confirmModalRef.onClose.subscribe((test: boolean) => {
.....
});
confirmModalRef.open();
}
But if I click on cancel button, I have the following error in the console:
ERROR TypeError: Cannot read property 'target' of undefined
at NgxSmartModalComponent.push../node_modules/ngx-smart-modal/esm5/ngx-smart-modal.js.NgxSmartModalComponent.dismiss
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
UIContextMenuInteraction : How to Dismiss Manually?
I was interested in the same thing, and calling UIViewController.dismiss(animated:completion:) on the source view controller dismisses it as ...
Read more >How to make a view dismiss itself - Hacking with Swift
The first option is to tell the view to dismiss itself using its presentation mode environment key. Any view can dismiss itself, regardless...
Read more >Close an app on your iPhone or iPod touch - Apple Support
Close an app on your iPhone or iPod touch. If an app won't respond or seems frozen, you can close it, then open...
Read more >Dismissing a pull request review - GitHub Docs
If your repository requires reviews, you can dismiss pull request reviews that are no longer valid or are unable to be approved by...
Read more >Why You Shouldn't Always Close Apps on Your Android Phone
1. Closing Android Apps Doesn't Increase Your Phone's Battery Life · 2. Your Android Phone Will Not Run Foreground Apps Faster · 3....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @maximelafarie, I was wrong in my application! because I was doing a stackblitz for you, and it works 😄 I forked it, because maybe it could be useful to someone else https://stackblitz.com/edit/angular-k9q4id?file=src/app/confirm-modal/confirm-modal.component.html
Well done @panagulis72! Thank you for the link, for sure it will help! Cheers! 🖖 😉