How to use a filter in javascript instead of the Html

angularjs

Solution

It's on Angular's filter documentation:

In HTML Template Binding

{{ filter_expression | filter:expression }}

In JavaScript

$filter('filter')(array, expression)

In your case, it would look something like `$filter('filter')(myList, mySearch)`.

Problem

I'm using AngularJS and it's great. I can't find it in the Documentation - What is the equivalent in Javascript to this AngularJS expression: ``` <div>{{ (myList| filter:mySearch).length }}</div> ``` Thanks for the help.

Original source

Related problems