Skip to content

Instantly share code, notes, and snippets.

@jodytate
Created February 21, 2015 20:35
Show Gist options
  • Select an option

  • Save jodytate/8fe0f8cd35ce0e0a1147 to your computer and use it in GitHub Desktop.

Select an option

Save jodytate/8fe0f8cd35ce0e0a1147 to your computer and use it in GitHub Desktop.
muppet filter test
<div ng-app="muppetApp" class="container" ng-controller="muppetController">
<h1>Muppet Filter Test</h1>
<ul class="list-unstyled list-inline">
<li>First set of muppets ({{muppetsResults.length}})</li>
<li>Second set of muppets ({{moreMuppetsResults.length}})</li>
</ul>
<form class="form-group">
<label>Filter your muppets</label>
<input type="text" class="form-control" ng-model="query">
</form>
<h2>Some Muppets</h2>
<div proposal-panel ng-repeat="item in muppets|filter:query as muppetsResults"></div>
<h2>Some More Muppets</h2>
<div proposal-panel ng-repeat="item in moreMuppets|filter:query as moreMuppetsResults"></div>
</div>
angular.module('muppetApp', [])
.controller('muppetController',['$scope', function($scope) {
$scope.muppets = [{
name: 'Kermit'
}, {
name: 'Fozzie'
}];
$scope.moreMuppets = [{
name: 'Ms. Piggie'
}, {
name: 'Gonzo',
}, {
name: 'Crazy Harry'
}];
}])
.directive('proposalPanel', function (){
return {
template: '<div class="panel panel-default">'+
'<div class="panel-body">{{item.name}}</div>'+
/* '<div class="panel-footer"><p><small>Muppet</small></p></div>' +*/
'</div>'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment