How can I filter a list of JSON objects (Products) by the 'category' variable using checkboxes?
An example product object is shown below:
{
'bikeId': 6,
'bikeName': 'Kids blue bike',
'bikeCode': 'KB-3075',
'releaseDate': 'June 28, 2016',
'description': 'Kids blue bike with stabilizers',
'category': 'kids',
'price': 290.00,
'starRating': 4.8,
'imageUrl': 'https://openclipart.org/image/2400px/svg_to_png/1772/bike-kid.png'
}
The current ngFor Loop code is as follows:
<tr *ngFor="let product of products">
<td><img *ngIf='showImage'
[src]='product.imageUrl'
[title]='product.bikeName'
[style.width.px]='imageWidth'></td>
<td>{{product.bikeName}}</td>
<td>{{product.bikeCode}}</td>
<td>{{product.releaseDate}}</td>
<td>{{product.price}}</td>
<td>{{product.starRating}}</td>
</tr>
And the current Checkboxes are as follows:
<input type="checkbox" name="All" value="true" /> Mens
<input type="checkbox" name="All" value="true" /> Womens
<input type="checkbox" name="All" value="true" /> Kids
I'm posting this question after searching forums all day with no luck. Many answers I found were either outdated or not working when I tested the code. Any assistance would be greatly appreciated.