try doing the other way around - instead od removing wines from result when 
they don't mach filtering, just add to result wines which do match 
filtering.

like that: http://jsfiddle.net/L4Z8a/

unfortunetely, you'll need special case for situation when no checkboxes 
are checked.



W dniu niedziela, 8 czerwca 2014 05:23:09 UTC+2 użytkownik [email protected] 
napisał:
>
> I'm using AngularJS to filter the results of a wine's list. The wines are 
> categorized by colors (red, white, rose, champagne), and other parameters 
> (countries). 
>
> When one color is checked with the check-box (red for example), a filtered 
> list of red wine appears. But when two colors are selected, no results 
> appears (red and white for example). Same problems if a check France and 
> Italie both.
>
> *my wishes:*
>
>    - My principal wish, would be to able to choose more than one 
>    parameter. For example if a check red and white for the color wines, and 
>    leger and France too, would be displayed the filtered list linked to the 
>    theses checked box (the list of the red and white wines from France, and 
>    leger)
>    
> here the code example:
>
>
> <div ng-controller="MainCtrl">
> <input ng-model="characteristics.red" type="checkbox" >red</input>
> <input ng-model="characteristics.white" type="checkbox" >white</input>
> <input ng-model="characteristics.rose" type="checkbox" >rose</input>
> <input ng-model="characteristics.champagne" type="checkbox" >champagne</input>
>     <br><br>
>  <input ng-model="characteristics.leger" type="checkbox" >leger</input>
> <input ng-model="characteristics.fort" type="checkbox" >fort</input>
>            <br><br>
>  <input ng-model="characteristics.france" type="checkbox" >france</input>
> <input ng-model="characteristics.italie" type="checkbox" >italie</input>
>         <br><br>
> <div ng-repeat="wine in filtered= (wines |filteredstoves:characteristics) | 
> filteredstoves:characteristics">
>
>     {{wine.name}} - {{wine.characteristics}}
>         </div>
>     <br><br>
>      Filtered list has {{filtered.length}} items</div>
>
>
> *Demo of the code:* http://jsfiddle.net/stefanos/kTYdd/31/ 
> <http://jsfiddle.net/stefanos/kTYdd/26/>
>
> it sounds very hard to code, i tried during hours without results
>
>
> <http://jsfiddle.net/stefanos/kTYdd/26/>
>
> regards,
>
> Stéphane
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to