Skip to content

Instantly share code, notes, and snippets.

@ZeroDragon
Created September 1, 2014 20:00
Show Gist options
  • Save ZeroDragon/5a8601346155e01483fa to your computer and use it in GitHub Desktop.
Save ZeroDragon/5a8601346155e01483fa to your computer and use it in GitHub Desktop.
a demo
<!doctype html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<hr>
<h1>Hello {{yourName}}!</h1>
<div ng-show="(140 - yourName.length)>=20">
{{140 - yourName.length}}
</div>
<div class="dred" ng-show="(140 - yourName.length)<20 && (140 - yourName.length)>=10">
{{140 - yourName.length}}
</div>
<div class="red" ng-show="(140 - yourName.length)<10">
{{140 - yourName.length}}
</div>
<div ng-class="((140 - yourName.length) < 20 ) ? 'dred' : ( ( (140 - yourName.length) < 10) ? 'red' : 'black' )">
COLORES
</div>
</div>
</body>
<style>
.dred{color:#a00;}
.red{color:#f00;}
.black{color:#000;}
</style>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment