lamarmarshall
12/2/2015 - 3:58 AM

angular custom validation

angular custom validation

<p>
		<label for="full_name">Full Name</label>
		
		<!-- each form must have name and html validation -->
		<!-- must have ng-class variable object with classes like this -->
		<input type="text" ng-model="formModel.fullname" name="full_name" required="required"
		 ng-pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$"
		ng-class="{
		green: theForm.full_name.$valid ,
		red: !theForm.full_name.$valid && !theForm.$pristine
		}"
		>
		</p>