1

I have an array of products that I'm repeating over using ng-repeat and am using

<div ng-repeat="product in products | filter:company_filter"> 

The filter is working but i want to pass some parameters to my filter like product type, ...

How can i do ?

3 Answers 3

2

You can add multiple parameters on your custom filter with the following syntax:

product in products | myFilter:firstParameter:secondParameter

Here's a working example

Sign up to request clarification or add additional context in comments.

Comments

1

In templates, you can separate filter arguments by colons.

{{ yourExpression | yourFilter: arg1:arg2:... }}

From Javascript, you call it as

$filter('yourFilter')(yourExpression, arg1, arg2, ...)

Comments

0

I think you can pass an object having multiple fields as a parameter of your filter:

<div ng-repeat="product in products | filter:params">
$scope.params = { company: "xyz", type: "abc" } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.