Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 2x 2x 2x 1x 1x 1x 1x | import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'; import { Category } from 'ish-core/models/category/category.model'; /** * The Category Image Component renders an HTML tag img of an image of a Category. */ @Component({ selector: 'ish-category-image', templateUrl: './category-image.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class CategoryImageComponent implements OnChanges { /** * The category for which the image should be displayed */ @Input({ required: true }) category: Category; categoryImageUrl = '/assets/img/not-available.svg'; ngOnChanges() { this.setCategoryImageUrl(); } /** * Set the category image URL from the (non-)empty property effectiveUrl. * The URL to a non-empty effectiveUrl has a prefix URL of property icmBaseURL. */ private setCategoryImageUrl() { if (this.category.images?.[0]?.effectiveUrl?.length > 0) { this.categoryImageUrl = `${this.category.images[0].effectiveUrl}`; } } } |