From ea2fe72b13cc752085ee469b8b51b2dfa2a03d50 Mon Sep 17 00:00:00 2001 From: Julian30520 Date: Tue, 11 Jan 2022 10:26:24 +0100 Subject: [PATCH] ajout listDataGlobal --- src/app/pages/page-accueil/page-accueil.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/pages/page-accueil/page-accueil.component.ts b/src/app/pages/page-accueil/page-accueil.component.ts index f55eb3f..a15c496 100644 --- a/src/app/pages/page-accueil/page-accueil.component.ts +++ b/src/app/pages/page-accueil/page-accueil.component.ts @@ -9,11 +9,13 @@ import * as _ from 'underscore'; }) export class PageAccueilComponent implements OnInit { public listData: any[]; + public listDataGlobal: any[]; public listRate: any[]; public listCategoriesFilter: string[]; constructor(private plantouneService: PlantouneService) { this.listData = []; + this.listDataGlobal = []; this.listRate = []; this.listCategoriesFilter = []; } @@ -35,6 +37,8 @@ export class PageAccueilComponent implements OnInit { this.plantouneService.getData().subscribe( (listPlant: any[]) => { console.log(listPlant); + this.listDataGlobal = [...listPlant]; + console.log(this.listDataGlobal); /** * Technique avec Underscore JS pour recupérer les catégories uniques de nos plantes @@ -68,7 +72,7 @@ export class PageAccueilComponent implements OnInit { onRatingFilter(stateNumber: number): void { console.log(stateNumber); this.listRate = []; - this.listData.forEach(product => { + this.listDataGlobal.forEach(product => { if(product.product_rating >= stateNumber) { this.listRate.push(product); }