Reputation: 2682
Array 1: Categories -> Category_Name, Category_Id
Array 2: Items -> Item_name ... etc , Category_Belonging_Id
I need to filter shown items based on selected category.
<div class="list>
<select>
<option ng-repeat="category in categories" ng-model="category_type">
{{category.Category_Name}}
</option>
</select>
<a ng-repeat="item in items | filter: // What should I put here?" href="#">
...
</a>
</div>
Upvotes: 0
Views: 76
Reputation: 740
Try this
<a ng-repeat="item in meatTypes | filter: {Category_Belonging_Id:category_type.Category_Id }" href="#">
Upvotes: 0
Reputation: 1605
first of all you should use ng-option
instead of ng-repeat
like
<select ng-model="category_type" ng-options="category.Category_Name for category in categories"></select>
and use filter
like
filter:{Category_Belonging_Id:category_type.Category_Id }
Upvotes: 1
Reputation: 7640
Assuming you have:
Catergory = {
id
name
}
and
MeatType{
id
catergoryId
name
}
You can do something like
<a ng-repeat="item in meatTypes | filter: {categoryId : catergory_type.id}" href="#">
Upvotes: 1