Skip to main content

Posts

Showing posts with the label angularjs required validation using ng-pattern

angularjs required validation using ng-pattern

This code sample are used to validate a  required  field with single word which  are given below. Table of Contents. input type is equal to text [ type="text" ]. ng-pattern with single word. Required element tag. ng-model with two way binding. Example code <! doctype html > < html > < head >   < title > angularjs requiredvalidation </ 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.singl...