Reputation: 71
I have a modal popup. It has a form-group-like registration form. And it has fields like text
, checkbox
, select
. If the user changes any form controls without saving the form, and then tries to close the modal popup, I would like to show a warning message to force saving changes or leaving the popup.
I've seen this Q&A, but I don't understand how it works. Where can I get the form-got-changed status in the FormIntactChecker
class?
Upvotes: 0
Views: 1226
Reputation: 2966
you can do it like so
form = FormGroup({}); // create your FormGroup here or if you already have it, just check
if (this.form.dirty) {}
Upvotes: 0