JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<div ng-app="validationApp" ng-controller="ExampleController">
<div class="container">
<form class="form-horizontal" name="signup_form" novalidate="">
<!-- HTML Type text -->
<div class="form-group" ng-class="{ 'has-error' : signup_form.textInput[0].$dirty && signup_form.textInput[0].$invalid, 'has-success' : signup_form.textInput[0].$valid }">
<label for="textInput" class="col-sm-2 control-label">Text</label>
<div class="col-sm-5">
<input type="text" class="form-control" name="textInput[0]" data-ng-model="textInput[0]" data-ng-minlength=3 data-ng-maxlength=10 data-ng-pattern='/^[a-zA-Z ]*$/' required="1" id="textInput[0]" placeholder="Text">
<div class="error-container" ng-show="signup_form.textInput[0].$dirty && signup_form.textInput[0].$invalid"> <small class="help-block" ng-show="signup_form.textInput[0].$error.required">Please input a username</small>
<small class="help-block" ng-show="signup_form.textInput[0].$error.minlength">at least 3 characters</small>
<small class="help-block" ng-show="signup_form.textInput[0].$error.maxlength">Your username cannot be longer than 10 characters</small>
<small class="help-block" ng-show="signup_form.textInput[0].$error.pattern">Invalid Pattern</small>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" ng-disabled="signup_form.$invalid" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
</div>
</div>
JavaScript
// create angular app
var validationApp = angular.module('validationApp', []);
// create angular controller
validationApp.controller('ExampleController', function ($scope) {
// function to submit the form after all validation has occurred
$scope.submitForm = function () {
// check to make sure the form is completely valid
if ($scope.signup_form.$valid) {
alert('our form is amazing');
}
};
});