Service restoByCat + icone

This commit is contained in:
Thomas Cardon 2022-02-04 14:13:52 +01:00
parent 48d4b68b9b
commit 1b520593cd
7 changed files with 110 additions and 63 deletions

View file

@ -2,8 +2,8 @@
<h2 class="titre ">Résultats :</h2>
<div class="separation"></div>
<div class="parent d-flex justify-content-center align-items-center flex-wrap flex-row ">
<div>
<app-card-resto></app-card-resto>
<div *ngFor="let restaurantData of listRestaurants">
<app-card-resto [restaurant]= "restaurantData"></app-card-resto>
</div>
</div>

View file

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ApiBackService } from 'src/app/services/api-back.service';
@Component({
selector: 'app-resto-page',
@ -7,9 +8,20 @@ import { Component, OnInit } from '@angular/core';
})
export class RestoPageComponent implements OnInit {
constructor() { }
public listRestaurants : any[];
constructor(private apiBackService : ApiBackService) {
this.listRestaurants = [];
}
ngOnInit(): void {
this.apiBackService.restoByCat.subscribe((restaurants: any[]) => {
this.listRestaurants = restaurants;
});
}
}