service api, page home, affiche categ,
install btsrap
This commit is contained in:
parent
4770bd2030
commit
e8a924144a
18 changed files with 166 additions and 9 deletions
3
src/app/pages/home-page/home-page.component.html
Normal file
3
src/app/pages/home-page/home-page.component.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div *ngFor="let category of listCategories">
|
||||
<app-card-category [categoryData]="category"></app-card-category>
|
||||
</div>
|
||||
0
src/app/pages/home-page/home-page.component.scss
Normal file
0
src/app/pages/home-page/home-page.component.scss
Normal file
25
src/app/pages/home-page/home-page.component.spec.ts
Normal file
25
src/app/pages/home-page/home-page.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
31
src/app/pages/home-page/home-page.component.ts
Normal file
31
src/app/pages/home-page/home-page.component.ts
Normal 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;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue