I think since your form has the "action" attribute your directive is not called. However you could submit your form if you subscribed to your button's click event and do: angular.element("#formId").submit() or with jquery: $("#formId").submit(); Of course the default event needs to get prevented.
So as a demonstration I'd use jQuery:
$(".submit-button").on("click", function (event) {
// prevent the default event - form won't get submited unless you manually do
event.preventDefault();
// do whatever you need before submitting
// then submit
$("#formId").submit();
});
BeginUmbracoForm + ng-submit
Is it possible to submit an MvcForm using AngularJS? I'm rendering the form like so:
Controller is simple, but will ultimately include a service reference to post the form:
At the moment, the submitForm method is not called. Angular knows about the form as the validation classes are all set correctly.
I want to submit using AngularJs and fallback to the browser POST if javascript is not available.
Hi!
ng-form documentation: https://docs.angularjs.org/api/ng/directive/ngSubmit
I think since your form has the "action" attribute your directive is not called. However you could submit your form if you subscribed to your button's click event and do: angular.element("#formId").submit() or with jquery: $("#formId").submit(); Of course the default event needs to get prevented.
So as a demonstration I'd use jQuery:
cheers, Peter
Thanks Peter, not sure how I missed that given it's the first freaking line of the Angular docs...
is working on a reply...