Skip to content

Instantly share code, notes, and snippets.

@wcc526
Created March 17, 2015 05:56
Show Gist options
  • Save wcc526/7b156dce6e2c44d9ba51 to your computer and use it in GitHub Desktop.
Save wcc526/7b156dce6e2c44d9ba51 to your computer and use it in GitHub Desktop.
angular table
<div ng-init="customers=[{name:'abc',city:'defg'},{name:'def',city:'helo'}]">
<input type="text" ng-model="customerFilter.name"/>
<table>
<tr>
<th ng-click="sortBy='name';reverse=!reverse">Name</th>
<th ng-click="sortBy='city';reverse=!reverse">City</th>
</tr>
<tr ng-repeat="cust in customers | filter:customerFilter.name | orderBy:sortBy:reverse" >
<td>[[ cust.name | uppercase ]]</td>
<td>[[ cust.city | uppercase ]]</td>
</tr>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment