mardi 23 février 2016

Angular ng-repeat filter uncheck all Checkboxes after search

I have a problem with my AngularJS ng-repeat filter. Always I filter in my ng-repeat with an input Field, Angular does uncheck all Checkboxes automatically. At the end, I would like to select specific categories. It's impossible to list all categories then i have over 100, therefore I look for a search. The "filter" Function of angular works pretty good, but uncheck all Checkboxes after search automatically. The boolean of the checkbox should be remain the same.

This ist my Code:

 <div ng-switch-when='e_categories'>
                <div class="chat-search">
                    <div class="fg-line">
                        <input type="text" class="form-control" ng-model="e_categoriesFilter" placeholder="E-Categories filtern">
                    </div>
                </div>
                <div vs-repeat>
                    <div class="checkbox m-10" ng-repeat="e_category in e_categories | filter:e_categoriesFilter">
                        <label>
                            <input type="checkbox" ng-model="eCategoryFilter" ng-click='filterByECategories(e_category)' value='@{{ e_category.id }}'>
                            <i class="input-helper"></i>
                            @{{ e_category.name }}
                        </label>
                    </div>
                </div>
            </div>

It looks so easy but I cant find an answer about this. Can u help me?




Aucun commentaire:

Enregistrer un commentaire