formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.23k stars 405 forks source link

Reset form on submit #629

Closed quintenvk closed 8 years ago

quintenvk commented 8 years ago

I've seen that this functionality exists for a reset-button (triggering vm.options.resetModel();). However, I'd like to do this after submitting my form (without calling 2 functions on my submit event, in case the additional server side validation returns any issues). Is there a way to do this?

I know vm can't be accessed from the controller, but it would be very convenient for me if i could still trigger the resetModel that way.

kentcdodds commented 8 years ago

You can do it in your submit handler. The submit handler is on the same scope as the form options.

kentcdodds commented 8 years ago

The GitHub issues on this repo are reserved for feature requests and bug reports. All questions should follow these instructions: help.angular-formly.com

So I'm going to go ahead and close this issue.