Added cart
This commit is contained in:
36
src/app/store/cart/cart.component.html
Normal file
36
src/app/store/cart/cart.component.html
Normal file
@ -0,0 +1,36 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<mat-card class="col-8">
|
||||
<table mat-table [dataSource]="cart" class="mat-elevation-z8">
|
||||
<ng-container matColumnDef="position">
|
||||
<th mat-header-cell *matHeaderCellDef> No. </th>
|
||||
<td mat-cell *matCellDef="let i = index"> {{i}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> Name </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Weight Column -->
|
||||
<ng-container matColumnDef="weight">
|
||||
<th mat-header-cell *matHeaderCellDef> Weight </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.weight}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Symbol Column -->
|
||||
<ng-container matColumnDef="symbol">
|
||||
<th mat-header-cell *matHeaderCellDef> Symbol </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.symbol}} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</mat-card>
|
||||
<mat-card class="col-4">
|
||||
Test
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
14
src/app/store/cart/cart.component.ts
Normal file
14
src/app/store/cart/cart.component.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {LocalStorage} from 'webstorage-decorators';
|
||||
|
||||
@Component({
|
||||
selector: 'cart',
|
||||
templateUrl: 'cart.component.html'
|
||||
})
|
||||
export class CartComponent {
|
||||
@LocalStorage({defaultValue: []}) cart: {id: string, name: string, cost: number, quantity: number}[];
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user