update: icon mechanic
This commit is contained in:
@@ -3,6 +3,7 @@ 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({
|
||||
@@ -16,7 +17,10 @@ export class HomeComponent implements OnInit {
|
||||
items$!: Observable<Item[]>;
|
||||
imgErrorMap = new Map<number, boolean>();
|
||||
|
||||
constructor(private apiService: Api) {}
|
||||
constructor(
|
||||
private apiService: Api,
|
||||
private iconService: IconService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.items$ = this.apiService.getItems();
|
||||
@@ -25,4 +29,8 @@ export class HomeComponent implements OnInit {
|
||||
onImgError(itemId: number) {
|
||||
this.imgErrorMap.set(itemId, true);
|
||||
}
|
||||
|
||||
isMaterialIcon(iconUrl: string): boolean {
|
||||
return this.iconService.isValidIcon(iconUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user