Reputation: 716
I have a "Saving" model that contains a value called "Retailer".
I would like to create an ng-repeat that only shows items with the same "Retailer".
basically im trying to fix this
<div ng-repeat="saving in savings | filter: { retailer: {{saving.retailer }} | limitTo:10">
But thats not correct.
How do i send in the "Saving" model value "Retailer" as the filter?
This seems to do the trick
<div ng-repeat="saving in savings | filter: { retailer: saving.retailer } | limitTo:10">
Upvotes: 0
Views: 71
Reputation: 8843
This should work AFAIK:
<div ng-repeat="saving in savings | filter: { retailer: 'Retailer' } | limitTo:10">
This should show those saving
objects with a retailer
property with value Retailer
.
Usually this is used with an input
and the user can filter the results.
Let's say we have this:
<input type="text" ng-model="filterText">
You can filter the savings using this input
the following way:
<div ng-repeat="saving in savings | filter: { retailer: filterText } | limitTo:10">
Upvotes: 1