AngularJS Example

by vinodlouis

HTML

<div ng-app="">
  <input type="button" value="set" ng-click="myVar='my-class'">
  <input type="button" value="clear" ng-click="myVar=''">
  <br>
  <span ng-class="myVar">Sample Text</span>
</div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<style>
​.ng-invalid { border: 1px solid red; }​
.my-class {
  color: red;
}