service api, page home, affiche categ,

install btsrap
This commit is contained in:
Thomas Cardon 2022-01-19 00:20:14 +01:00
parent 4770bd2030
commit e8a924144a
18 changed files with 166 additions and 9 deletions

View file

@ -0,0 +1,3 @@
<div *ngFor="let category of listCategories">
<app-card-category [categoryData]="category"></app-card-category>
</div>

View file

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomePageComponent } from './home-page.component';
describe('HomePageComponent', () => {
let component: HomePageComponent;
let fixture: ComponentFixture<HomePageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomePageComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomePageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,31 @@
import { Component, OnInit } from '@angular/core';
import { ApiBackService } from 'src/app/services/api-back.service';
@Component({
selector: 'app-home-page',
templateUrl: './home-page.component.html',
styleUrls: ['./home-page.component.scss']
})
export class HomePageComponent implements OnInit {
listCategories : string[];
constructor(private apiBackService : ApiBackService) {
this.listCategories = [];
}
ngOnInit(): void {
this.apiBackService.getCategories().subscribe((listCategories: any[]) => {
console.log(listCategories);
// const listCategoriesLibelle = listCategories.map(
// (category) => category.libelle
// );
this.listCategories = listCategories;
});
}
}