I am going to share the interesting topic to validate input form, This input form contains to Required input text field. input phone number . input web URL address. Email validation etc. All the above are used to ng-pattern attribute to validate to each field. The Example code as given below <! doctype html > < html > < head > < title > angularjs form validation </ title > < script src =" http://code.angularjs.org/1.2.9/angular.min.js "></ script > < style > .error { color : red ; } </ style > < script > var app = angular.module( 'myApp' , []); app.controller( 'mainCtrl' , function ($scope) { $scope.username = '' ; $scope.word = /^\s*\w*\s*$/ ; $scope.webURL = '' ; $scope.phoneNumbr = /^\+?\d{2}[- ]?\d{3}[- ]?\d{5}$/ ;
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers