I'm working on an app that uses ionic and angular js framework. I have a problem with filters in AngularJS. Filter an array according to a parameter that gets me by url, eg an array of offers to choose a category appear only offers that category:
.controller('OfertasCategoria', function($scope, $stateParams, OfertasService, CategoriasService, $filter) {
$scope.categorias = $filter('filter')
(CategoriasService.getCategorias(), {id: $stateParams.id_categoria}, true)[0];
$scope.ofertas = $filter('filter')(OfertasService.getOfertas(), {
id_categoria: $stateParams.id_categoria}, true)[0];
})
To display the results I use ng-repeat:
<ion-item ng-repeat="oferta in ofertas" href="#/app/ofertas/{{ofertas.id}}" class="item item-thumbnail-left">
The filter applies but only displays the first item that coicide and repeated several times.
Have you any idea which may be due?