Answer the question
In order to leave comments, you need to log in
Is it necessary to filter a collection in Angular?
Hello, help me understand the process of implementing sorting (filtering) of goods in an online store on Angular.
Let's just say, there is an array or a database from which I display data (name, price, category, etc.) The
user needs to be able to filter the list of goods, say by price, or he enters the desired name into the input and the goods are displayed to him in according to his request.
So, in Angular this is done quite simply,
Here I display a list of products
<tr ng-repeat="product in products | filter:query | orderBy:predicate | orderBy:price">
<td> {{ product.title }} </td>
<td> {{ product.price}} </td>
<td> {{ product.description }} </td>
<td> {{ product.mutch }} </td>
<td> {{ product.state }} </td>
</tr>
Tittle: <input type="text" ng-model="query.title" class="form-control">
<select id="bedroom-filter" ng-model="query.mutch">
<option value>All</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select><br />
Answer the question
In order to leave comments, you need to log in
but then the user will not have the opportunity to do something himself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question