Routing(id) vers page Details
This commit is contained in:
		
							parent
							
								
									4b18ed8b44
								
							
						
					
					
						commit
						f1d0af652b
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -12,17 +12,17 @@ import * as _ from 'underscore';
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export class PageAccueilComponent implements OnInit {
 | 
					export class PageAccueilComponent implements OnInit {
 | 
				
			||||||
  public listData: any[];
 | 
					  public listData: any[];
 | 
				
			||||||
  public listRate: any[];
 | 
					 | 
				
			||||||
  public listPricePlant : any[];
 | 
					  public listPricePlant : any[];
 | 
				
			||||||
  public clickCounter : any;
 | 
					  public clickCounter : any;
 | 
				
			||||||
 | 
					  public listDataGlobal : any[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public listCategoriesFilter: string[];
 | 
					  public listCategoriesFilter: string[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(private plantouneService: PlantouneService) {
 | 
					  constructor(private plantouneService: PlantouneService) {
 | 
				
			||||||
    this.listData = [];
 | 
					    this.listData = [];
 | 
				
			||||||
    this.listRate = [];
 | 
					 | 
				
			||||||
    this.listCategoriesFilter = [];
 | 
					    this.listCategoriesFilter = [];
 | 
				
			||||||
    this.listPricePlant = [];
 | 
					    this.listPricePlant = [];
 | 
				
			||||||
 | 
					    this.listDataGlobal = [];
 | 
				
			||||||
    this.clickCounter = 0;
 | 
					    this.clickCounter = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,6 @@ export class PageAccueilComponent implements OnInit {
 | 
				
			||||||
    * }
 | 
					    * }
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.plantouneService.getData().subscribe(
 | 
					    this.plantouneService.getData().subscribe(
 | 
				
			||||||
| 
						 | 
					@ -67,12 +65,15 @@ export class PageAccueilComponent implements OnInit {
 | 
				
			||||||
        this.listData = listPlant;
 | 
					        this.listData = listPlant;
 | 
				
			||||||
        this.listData.length = 9;
 | 
					        this.listData.length = 9;
 | 
				
			||||||
        // console.log(this.listData);
 | 
					        // console.log(this.listData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.listDataGlobal = [...listPlant]
 | 
				
			||||||
 | 
					        console.log("coucou" + this.listDataGlobal);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onEventLike() {
 | 
					  onEventLike() {
 | 
				
			||||||
    this.plantouneService.plantLiked$.next('')
 | 
					    this.plantouneService.plantLiked$.next('');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //Tri des prix des plantes par ordre croissant ou décroissant
 | 
					  //Tri des prix des plantes par ordre croissant ou décroissant
 | 
				
			||||||
| 
						 | 
					@ -81,9 +82,9 @@ onPriceTri() : void {
 | 
				
			||||||
this.clickCounter ++
 | 
					this.clickCounter ++
 | 
				
			||||||
console.log(this.clickCounter)
 | 
					console.log(this.clickCounter)
 | 
				
			||||||
  if (this.clickCounter %2) {
 | 
					  if (this.clickCounter %2) {
 | 
				
			||||||
    this.listData.sort((a, b) => parseFloat(b.product_price) - parseFloat(a.product_price));
 | 
					 | 
				
			||||||
    }else{
 | 
					 | 
				
			||||||
    this.listData.sort((a, b) => parseFloat(a.product_price) - parseFloat(b.product_price));
 | 
					    this.listData.sort((a, b) => parseFloat(a.product_price) - parseFloat(b.product_price));
 | 
				
			||||||
 | 
					    }else{
 | 
				
			||||||
 | 
					    this.listData.sort((a, b) => parseFloat(b.product_price) - parseFloat(a.product_price));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue