So i have described my problem, later on. Is there any solutions for my problems ?
My filter function
$scope.filtered = function(){
for(var i = 0; i < $scope.inventories.length; i++) {
$scope.filtered_inventories = new Inventory().query($scope.filtrs).$object;
}
};
In my template
<select ng-model="filtrs.model" ng-change="filtered()">
<option value="">Model</option>
<option ng-repeat="inventory in inventories" value="{{inventory.model}}">{{inventory.model}}</div>
</select>
<!--filter inventory Manufacturer-->
<select ng-model="filtrs.manufacturer" ng-change="filtered()">
<option value="">Manufacturer</option>
<option ng-repeat="inventory in inventories" value="{{inventory.manufacturer}}">{{inventory.manufacturer}}</div>
</select>
When i filter using one select, it filtrs
{
"manufacturer": "Samsung"
}
When i diselect value and choose Manufacturer it shows
{
"manufacturer": ""
}
So when i choose Model and deselected manufacturer it does n`t show anything because manufacturer still appears as nothing PROBLEM NR1
{
"manufacturer": "",
"model": "M2112"
}
Second problem is that i choose two different values in those selects it display again everything, but logically it should show anything. PROBLEM NR2
That's not how you define options inside a select in angularjs
Please have a look at: http://docs.angularjs.org/api/ng/directive/select.
That's how your code should look like:
<select ng-model="filtrs.model"
ng-change="filtered()"
ng-options="inventory.model as inventory.model for inventory in inventories">
<option value="">Model</option>
</select>
<!--filter inventory Manufacturer-->
<select ng-model="filtrs.manufacturer"
ng-change="filtered()"
ng-options="inventory.manufacturer as inventory.manufacturer for inventory in inventories">
<option value="">Manufacturer</option>
</select>
Once, you've changed your code, let me know if you still have issues.