Skip to content

Instantly share code, notes, and snippets.

@MarcoGomesr
Created June 18, 2014 15:59
Show Gist options
  • Save MarcoGomesr/ab1d9e1f5e805e6033f2 to your computer and use it in GitHub Desktop.
Save MarcoGomesr/ab1d9e1f5e805e6033f2 to your computer and use it in GitHub Desktop.
animate validation angularjs
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Controladores</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
</head>
<body>
<div class="container">
<form role="form" name="form">
<div class="form-group has-feedback" ng-class="{'has-error': form.emailU.$invalid , 'has-success': form.emailU.$valid}">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" name="emailU" ng-model="user.email" required />
<!-- 1er method
<div ng-show="form.emailU.$invalid">
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div ng-show="form.emailU.$valid">
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
</div> -->
<span class="glyphicon form-control-feedback" ng-class="{'glyphicon-remove': form.emailU.$invalid , 'glyphicon-ok': form.emailU.$valid}" ></span>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" name="passwordU" ng-model="user.password" required />
</div>
<div ng-show="form.emailU.$dirty && form.passwordU.$invalid">
<p class=" text-danger" ng-show="form.emailU.$error.required">require</p>
<p class=" text-danger" ng-show="form.emailU.$error.email">invalid email</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="check" ng-model="user.acept" required > Check me out
</label>
</div>
<button type="submit" class="btn btn-success" ng-disabled="form.$invalid">Submit</button>
</form>
</div>
<script src="bower_components/angular/angular.js"></script>
<script src="app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment