Angular Checkbox Filtering I'm very new to Angular, and trying to get my head around whether or not I'm doing it the Right Way (tm).

I want to filter a set of results by their properties, where if none of the filters are checked, all the results are displayed, but if one or more filters are checked, all results which match the checked properties are displayed.

I've setup a simple demo with the colours of fruit. The JSFiddle is available at http://jsfiddle.net/mattdwen/u5eBH/2/

The HTML has a series of checkboxs and a repeating list for the set results:

&lt;div ng-app="fruit"&gt;
    &lt;div ng-controller="FruitCtrl"&gt;

        &lt;input type="checkbox" ng-click="includeColour('Red')"/&gt; Red&lt;/br/&gt;
        &lt;input type="checkbox" ng-click="includeColour('Orange')"/&gt; Orange&lt;/br/&gt;
        &lt;input type="checkbox" ng-click="includeColour('Yellow')"/&gt; Yellow&lt;/br/&gt;

        &lt;ul&gt;
            &lt;li ng-repeat="f in fruit | filter:colourFilter"&gt;
                {{f.name}}
            &lt;/li&gt;
        &lt;/ul&gt;

        Filter dump: {{colourIncludes}}
    &lt;/div&gt;
&lt;/div&gt;


And the JS adds the checked properties to a scope array, and the filter checks if the fruit colour is in that array:

'use strict'

angular.module('fruit', []);

function FruitCtrl($scope) {
    $scope.fruit = [
        {'name': 'Apple', 'colour': 'Red'},
        {'name': 'Orange', 'colour': 'Orange'},
        {'name': 'Banana', 'colour': 'Yellow'}];

    $scope.colourIncludes = [];

    $scope.includeColour = function(colour) {
        var i = $.inArray(colour, $scope.colourIncludes);
        if (i &gt; -1) {
            $scope.colourIncludes.splice(i, 1);
        } else {
            $scope.colourIncludes.push(colour);
        }
    }

    $scope.colourFilter = function(fruit) {
        if ($scope.colourIncludes.length &gt; 0) {
            if ($.inArray(fruit.colour, $scope.colourIncludes) &lt; 0)
                return;
        }

        return fruit;
    }
}


It doesn't really feel 'Angular' enough to be the correct way to achieve this?
You're attempting to handle the data binding yourself by creating arrays to store objects based on the click event. Angular does the two way binding for you.  

Basically, I assign a new property named "included" by assigning it as the model to the input checkbox. Then I use that property on the filter of the fruit array to display only the one's whose colour is selected.

&lt;div ng-app="fruit"&gt;
    &lt;div ng-controller="FruitCtrl"&gt;
        &lt;div ng-repeat="f in fruit"&gt;
            &lt;input type='checkbox' ng-model='f.included'&gt;&lt;/input&gt;{{f.colour}}
        &lt;/div&gt;
        &lt;ul&gt;
            &lt;li ng-repeat="f in fruit | filter:{included:true}"&gt;{{f.name}}&lt;/li&gt;
        &lt;/ul&gt;
&lt;/div&gt;


angular.module('fruit', []);

function FruitCtrl($scope) {
    $scope.fruit = [
        {'name': 'Apple', 'colour': 'Red'},
        {'name': 'Orange', 'colour': 'Orange'},
        {'name': 'Banana', 'colour': 'Yellow'}
    ];
}