Files
dashboard/frontend/src/app/components/home/home.ts
jafreli fa86607af3
All checks were successful
Build and Push Docker Images / build-and-push-backend (push) Successful in 7s
Build and Push Docker Images / build-and-push-frontend (push) Successful in 15s
update: icon mechanic
2026-01-31 17:41:20 +01:00

36 lines
958 B
TypeScript

import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MaterialModule } from '../../material.module';
import { Api } from '../../services/api';
import { Item } from '../../models/item';
import { IconService } from '../../services/icon.service';
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: Api,
private iconService: IconService
) {}
ngOnInit(): void {
this.items$ = this.apiService.getItems();
}
onImgError(itemId: number) {
this.imgErrorMap.set(itemId, true);
}
isMaterialIcon(iconUrl: string): boolean {
return this.iconService.isValidIcon(iconUrl);
}
}