Joined August 2014
·
Posted to
AngularJS: How to prevent form submission after click on button?
over 1 year
ago
Hey, I think you're naming your functions badly.
There's a directive called ng-submit which you can use. You cannot mix it with action=""
however as angular will process it normally.
<form name="someform" ng-submit="someform.$valid && submit(someform)" novalidate>
then
$scope.submit = function(form){
// angular will do whatever you say in here.
// default form action prevented.
}
DUDE THIS IS EXACTLY WHAT I AM LOOKING FOR!
However, I get a 500 error.
Where is your angular code sitting? On the top level of WordPress, or as a theme?
Which leads to the next question... how did you handle nonces?