@@ -60,7 +60,8 @@ angular.module('akoenig.deckgrid').factory('DeckgridDescriptor', [
6060 '</div>' ;
6161
6262 this . scope = {
63- 'model' : '=source'
63+ 'model' : '=source' ,
64+ 'filter' : '='
6465 } ;
6566
6667 //
@@ -75,7 +76,6 @@ angular.module('akoenig.deckgrid').factory('DeckgridDescriptor', [
7576 // Will be incremented if using inline templates.
7677 //
7778 this . $$templateKeyIndex = 0 ;
78-
7979 }
8080
8181 /**
@@ -163,8 +163,9 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [
163163
164164 '$window' ,
165165 '$log' ,
166+ '$filter' ,
166167
167- function initialize ( $window , $log ) {
168+ function initialize ( $window , $log , $filter ) {
168169
169170 'use strict' ;
170171
@@ -175,6 +176,7 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [
175176 function Deckgrid ( scope , element ) {
176177 var self = this ,
177178 watcher ,
179+ filterWatcher ,
178180 mql ;
179181
180182 this . $$elem = element ;
@@ -199,6 +201,9 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [
199201
200202 this . $$watchers . push ( watcher ) ;
201203
204+ filterWatcher = this . $$scope . $watchCollection ( 'filter' , this . $$onModelChange . bind ( this ) ) ;
205+ + this . $$watchers . push ( filterWatcher ) ;
206+
202207 //
203208 // Register media query change events.
204209 //
@@ -213,7 +218,7 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [
213218
214219 self . $$watchers . push ( onDestroy ) ;
215220 } ) ;
216-
221+
217222 mql = $window . matchMedia ( '(orientation: portrait)' ) ;
218223 mql . addListener ( self . $$onMediaQueryChange . bind ( self ) ) ;
219224
@@ -305,7 +310,7 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [
305310
306311 this . $$scope . columns = [ ] ;
307312
308- angular . forEach ( this . $$scope . model , function onIteration ( card , index ) {
313+ angular . forEach ( $filter ( 'filter' ) ( this . $$scope . model , this . $$scope . filter ) , function onIteration ( card , index ) {
309314 var column = ( index % self . $$scope . layout . columns ) | 0 ;
310315
311316 if ( ! self . $$scope . columns [ column ] ) {
0 commit comments