Emidomh Emidomh - 8 months ago 19
AngularJS Question

Using angular, Is it possible somehow to display a value with a filter directly to html code?

Usualy, you are using filter directly in your html code like this :

<div ng-repeat="product in products | filter:{ category : 'car' }">

But in my case I need to use filter to display a value. Something like this :

<p> {{products.length | filter:{category : 'car'} }} Car Product(s) found.</p>

In order to get as output :

8 Car Product(s) found.


I know how to do it using javascript but this is not what I'm looking for. I want to know if it's possible to do it directly in my html code.


You can use :

<div ng-repeat="product in filter = ( products | filter:{ category : 'car' })">

And to display the amount just :