angular-unsavedChanges
angular-unsavedChanges copied to clipboard
Ability to ignore a non-reset button (i.e. non-submit type Submit)
Matt,
Great plugin. Implementing in a project and having issues with the warning being triggered when submitting a form. My current submit button is not type="submit", and was hoping you might have a suggestion on how to ignore warning and allow the form to submit in this case. My button code is below:
<button class="btn btn-primary" ng-click="confirm()">Save</button>
Thanks!
Just a follow up:
Adding type="submit" to a button actually does allow a regular button to work for this. So the following is valid:
<button class="btn btn-primary" type="submit" ng-click="confirm()">Save</button>
Though I'm not sure whether it's a semantically valid attribute for the button element. Would it be possible to include a directive, say something like unsaved-warning-allow or unsaved-warning-ignore (not sure what's best) to force a particular element to ignore the warning?
Thanks again!
I put unsaved-warning-clear on my button-looking <a> tags, works alright for me. Give it a shot.
@trnelson That's strange. When unspecified, default value for button[type] is submit. There's must be a bug somewhere else.
I always use type=button. How are you handling form submission?