Angular: Empty Fiddle
http://angularjs.org/
HTML
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<div ng-controller="MainCtrl">
Filter By Title:
<div class="btn-group">
<button
type="button"
ng-repeat="title in titles"
class="btn btn-default"
ng-model="selected[title]"
btn-checkbox
ng-class="{active: title == selectedTitle}"
ng-click="setSelectedTitle(title)">{{title}}</button>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Title</th>
<th>Text</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="entry in entries | filter:byTitle">
<td>{{entry.title}}</td>
<td>{{entry.text}}</td>
</tr>
</tbody>
</table>
</div>
CSS
@import url('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
JavaScript
var app = angular.module('myApp', []);
app.controller('MainCtrl', function($scope, $q) {
$scope.setSelectedTitle = function (value) {
if ($scope.selectedTitle === value) {
$scope.selectedTitle = undefined;
} else {
$scope.selectedTitle = value;
}
};
$q.when({ data: [
{ title: 'sometitle', text: 1 },
{ title: 'anothertitle', text: 2 },
{ title: 'sometitle', text: 3 },
{ title: 'someothertitle', text: 4 },
{ title: 'sometitle', text: 5 },
{ title: 'anothertitle', text: 6 },
{ title: 'anothertitle', text: 7 },
{ title: 'yetanothertitle', text: 8 },
]})
.then(function(res){
$scope.entries = res.data;
});
$scope.titles = ["sometitle","someothertitle","anothertitle"];
$scope.byTitle = function(entry){
return entry.title === $scope.selectedTitle || $scope.selectedTitle === undefined;
};
} );