Developing my app I encountered with a problem, I have a filter in my ng-repeat. I can search by productCode
or name. After that appears a new requirement "Filter by SubcategoryId
".
The product is associated to a subcategory but I have the problem to filter exactly only by subCategoryId
strictly and the productCode
or name with proximity search.
Result:
Filtering by subCategoryId = 1
Only I want to show subCategoryId
products but it brings a product list with SubcategoryId = 1, 11, 111 etc..
It's there a way to filter exactly by subCategoryId
and the name, codigoProducto with proximity?
Filters Layout
<input placeholder="PALABRA CLAVE" type="text" ng-model="filtros.name" ng-change="changeCurrentPage(0);" />
<input placeholder="CODIGO PRODUCTO" type="text" ng-model="filtros.codigoProducto" ng-change="changeCurrentPage(0);"/>
<select ng-model="filtros.subCategoryId" ng-change="changeCurrentPage(0)">
<option value="">TODOS</option>
<option ng-repeat="subct in subCategories" value="{[{subct.id}]}"{[{subct.name}]}</option>
</select>
List.
<li ng-animate="'animate'" ng-repeat="prod in objtemp.products | orderBy:'ordenProducto' | filter:filtros | startFrom:currentPage*pageSize:this | limitTo:pageSize" ng-class='{marginLeftNone: $index%4==0}' >
Sorry for my bad English.
Thank you so much if You can help me.
Post Edited.
This is the jsfiddle.
The model has changed so now it's working. Thank You everybody for your help, Also I updated jsfiddle because it's a helpful source and You can rework.
..... var myApp = angular.module('myApp',[]); .....
....
<ul><li ng-repeat="item in model.data | filter: { subCategoryId: filtros.subCategoryId }">{{item.title}}</li>
这是您的过滤器的示例
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.