Skip to content

Instantly share code, notes, and snippets.

@nareeboy
Created April 10, 2014 22:12
Show Gist options
  • Save nareeboy/10428139 to your computer and use it in GitHub Desktop.
Save nareeboy/10428139 to your computer and use it in GitHub Desktop.
Angular - simple data sorter
<div class="main" ng-controller="MyController">
<div class="search">
<h1>Artist Search</h1>
<label for="">search</label>
<input ng-model="query" placeholder="search for artist" autofocus>
<label class="formgroup">By:
<select ng-model="artistOrder">
<option value="name">Name</option>
<option value="reknown">reknown</option>
</select>
</label>
<label class="formgroup">
<input type="radio" ng-model="direction" name="direction" checked>
ascending
</label>
<label class="formgroup">
<input type="radio" ng-model="direction" name="direction" value="reverse">
descending
</label>
</div>
<ul class="artistlist">
<li class="artist cf" ng-repeat="item in artists | filter:query | orderBy: artistOrder:direction">
<img ng-src="images/{{item.shortname}}_tn.jpg" alt="photo of {{item.name}}">
<div class="info">
<h2>{{item.name}}</h2>
<h3>{{item.reknown}}</h3>
</div>
</li>
</ul>
<!-- <h1>{{author.name}}</h1> -->
<!-- <p>{{author.title + ', ' + author.company}}</p> -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment