Update Frontend. Added Homepage
This commit is contained in:
28
frontend/src/app/components/home/home.ts
Normal file
28
frontend/src/app/components/home/home.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { ApiService } from '../../services/api';
|
||||
import { Item } from '../../models/item';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MaterialModule],
|
||||
templateUrl: './home.html',
|
||||
styleUrls: ['./home.scss']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
items$!: Observable<Item[]>;
|
||||
imgErrorMap = new Map<number, boolean>();
|
||||
|
||||
constructor(private apiService: ApiService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.items$ = this.apiService.getItems();
|
||||
}
|
||||
|
||||
onImgError(itemId: number) {
|
||||
this.imgErrorMap.set(itemId, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user