Ads

Thursday, 24 July 2014

How to disabled HTML5 validation using Angular.js

Angular.js has facility to restrict HTML5 validation. All input fields can validate against some basic HTML5 validations, like minimum length, maximum length, etc. These are entirely available on the new HTML5 attributes of a manikin.

It is usually a great idea to use the novalidate flag on the configuration factor. This will prevent the browser from submitting the form.

 <!DOCTYPE html>  
 <html>  
   <head>  
     <!-- CSS -->  
     <!-- load bootstrap -->  
     <link rel="stylesheet" href="css/bootstrap.min.css">   
     <style>  
       body      { padding-top:30px; }  
     </style>  
     <!-- JS -->  
     <!-- load angular -->  
     <script src="js/anguler_1.2.js"></script>   
     <script src="js/app.js"></script>  
   </head>  
   <body ng-app="formValidationApp" ng-controller="formController">  
     <div class="container">  
       <form name="signup_form" novalidate ng-submit="signupForm()">  
         <fieldset>  
           <legend>Signup</legend>  
           <button type="submit" class="button radius">Submit</button>  
         </fieldset>  
       </form>  
     </div>  
   </body>  
 </html>  

In Above example we have put novalidate flag in <form> tag, that will prevent to HTML validation.