Favorite products#100
Conversation
chandradot99
commented
Apr 24, 2018
- mark a product as favorite from the product page.
- It gives user the ability to see all products marked as favorite by him/her
- Admin can view which products have been marked as favorite, and by which users, on the Admin end.
There was a problem hiding this comment.
add return types for http methods here too markAsFavorite(id: number): <Return Type> { return this.http.post(/spree/favorite_products, {id: id}) }`
There was a problem hiding this comment.
please use bootstrap classes only here for modularity purposes.
There was a problem hiding this comment.
Can we use a default value here as an empty array. So that we don't do length check here.
Just *ngIf="products$ | async; let products; else elseBlock" would be enough.
There was a problem hiding this comment.
@pkrawat1 if we use this, then empty array would always return true and else block will never run.
There was a problem hiding this comment.
<div *ngIf="products$ | async; let products">
<table class="table" *ngIf="products.length; else elseBlock">
<thead class="thead-light">
<tr>
<th scope="col">Product Image</th>
<th scope="col">Product Name</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<app-favorite-product-list-item *ngFor="let product of products" [product]="product"></app-favorite-product-list-item>
</tbody>
</table>
<ng-template #elseBlock>
<div>You have'nt favorited anything yet.</div>
</ng-template>
</div>There was a problem hiding this comment.
why async twice 🤨 here. use *ngIf="products$ | async; let products; else elseBlock"
There was a problem hiding this comment.
indentation or autocorrect please
802df1f to
465ee54
Compare
There was a problem hiding this comment.
<div *ngIf="products$ | async; let products">
<table class="table" *ngIf="products.length; else elseBlock">
<thead class="thead-light">
<tr>
<th scope="col">Product Image</th>
<th scope="col">Product Name</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<app-favorite-product-list-item *ngFor="let product of products" [product]="product"></app-favorite-product-list-item>
</tbody>
</table>
<ng-template #elseBlock>
<div>You have'nt favorited anything yet.</div>
</ng-template>
</div>add favorite product functionality remove from favorite functionality remove unmark as favorite option from product detail page indentation and bug fixes use async pipe in view only once
465ee54 to
29b3557
Compare
add favorite product functionality remove from favorite functionality remove unmark as favorite option from product detail page indentation and bug fixes use async pipe in view only once