Kristijan,

Thanks for your javascript code, it helps me to build the filter function
and to understand better the filter system.


On Mon, Jun 9, 2014 at 4:02 AM, kristijan budimir <[email protected]>
wrote:

> pure javascript:
> var wines = [];
> function filterrData(wines, name, type, country, style) {
>     var filteredData = wines.filter(function(entity){
>         // just nest all of the results here
>         var wineName = name || entity.name;
>         if(entity.name === wineName) return true;
>         else return false
>     });
> }
>
> On Sunday, June 8, 2014 5:40:23 PM UTC+2, [email protected] wrote:
>>
>> I have a json wine list, and my wish is to build a code with AngularJS to
>> filter the results
>>
>> the json file
>>
>> [{ "name": "Wine a", "type": "red", "country": "france", "style": "strong" 
>> },{ "name": "Wine a", "type": "white", "country": "italie", "style": 
>> "medium" },{ "name": "Wine a", "type": "white", "country": "france", 
>> "style": "light" },{ "name": "Wine a", "type": "rose", "country": "usa", 
>> "style": "strong" },{ "name": "Wine a", "type": "champagne", "country": 
>> "chili", "style": "medium" },{ "name": "Wine a", "type": "red", "country": 
>> "brazil", "style": "strong" },{ "name": "Wine a", "type": "red", "country": 
>> "france", "style": "strong" }
>> ]
>>
>> the check-boxes
>>
>> <div ng-controller="MainCtrl">
>>     <input ng-model="red" type="checkbox" >red</input>
>>     <input ng-model="white" type="checkbox" >white</input>
>>     <input ng-model="rose" type="checkbox" >rose</input>
>>     <input ng-model="champagne" type="checkbox" >champagne</input>
>>
>>     <input ng-model="france" type="checkbox" >france/input>
>>     <input ng-model="italie" type="checkbox" >italie</input>
>>     <input ng-model="brazil" type="checkbox" >brazil</input>
>>     <input ng-model="chili" type="checkbox" >chili</input>
>>
>>     <input ng-model="strong" type="checkbox" >strong</input>
>>     <input ng-model="medium" type="checkbox" >medium</input>
>>     <input ng-model="light" type="checkbox" >light</input>
>> </div>
>>
>> *my wish*
>>
>> My wish is to build a dynamic multi parameter filter list,the result of
>> the list would match with the values of the check-boxes.
>>
>>    -
>>
>>    if i check red and strong, would appears in the list, only the wines
>>    from the json list with these parameter (a list of red and strong wines).
>>    -
>>
>>    if i check red, white and france, would appears in the list, only the
>>    wines from the json list with these parameter ( a list of red and white
>>    wines from france).
>>
>> i tried many solution, with no results. It seems to be hard to code!!
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/T_S3RjBohPs/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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