Hey there,
actually your usage of filter is correct - to make it working there are two solutions (depending on how you want it):
Wait until the promise is resolved before calling $scope.search, i.e.
Items.then(function(data) {
$scope.items = data;
//call $scope.search here, instead of calling it on line 106
$scope.search();
});
this seems to be the better solution in my opionion.
The other way to do it, would be to initialize $scope.items with an empty array, i.e. at the top of your controller declare:
$scope.items = [];
The problem right now is, that the filters are running before $scope.items is set ($scope.items is therefore undefined, and has no .length attribute),
by previously assigning it an empty array, this bug would be fixed.
- Flo