Skip to content

Instantly share code, notes, and snippets.

@wcc526
Created March 15, 2015 07:59
Show Gist options
  • Save wcc526/38f265b6f0127baa83b4 to your computer and use it in GitHub Desktop.
Save wcc526/38f265b6f0127baa83b4 to your computer and use it in GitHub Desktop.
ng-class
<section>
<p>
<p>
<span ng-class="{'label-success':focus}" class="label label-default">Focus!</span>
<span ng-class="{'label-warning':!focus}" class="label label-default">Blur!</span>
</p>
<input ng-model="title" class="form-control" ng-focus="focus=true" ng-blur="focus=false" placeholder="Enter a title for your book"/>
<div class="panel">
<p> <h1> [[ focus ]]</h1> The title of your book is [[ title.length ? title : "No Name" ]] </p>
</div>
</p>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment