Created
January 6, 2022 13:41
-
-
Save Bilkiss/392b79d2f6089273a3cdeb1ed3530f8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { StorageService } from '../../services/storage.service'; | |
@Component({ | |
selector: 'app-list', | |
templateUrl: './list.component.html', | |
styleUrls: ['./list.component.scss'] | |
}) | |
export class ListComponent implements OnInit { | |
productList$ = this.storage.watch('products'); | |
constructor( | |
public storage: StorageService | |
) { } | |
ngOnInit(): void { | |
} | |
removeStoreProduct(name: string): void{ | |
let list = this.storage.get('products'); | |
if (!list) { | |
list = []; | |
} | |
list = list.filter( (x: any) => x.name != name); | |
this.storage.set('products', list); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment