angularjs - How to prevent Angular form from being sent to a php file (method="post") when invalid? -


i guess in such case default of angular add ng-disabled submit button. if so, user warned errors in each input, errors shown instantly. there way show errors (through function in controller or other way), after onclick, without having form submitted , send php if invalid?

html

   <form name="myform">          <input type="text" name="textfield" ng-model="textfield"/>          <md-button type="button"                     class="btn-width-medium md-raised md-primary"                      ng-click="validateform()">                 save          </md-button>     </form 

controller :

.controller("controller",function($scope){    $scope.validateform = function(){       // validation here       // if valid           // submit form - post data       // else invalid          // show message , return    }; }); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -