Overview
TheAirlineDisplayComponent intelligently displays airline branding by showing either an airline logo image (when available) or fallback text. It checks if a logo exists for the given ICAO code and automatically handles cases where logos are unavailable.
Selector: app-airline-display
Location: src/app/features/flights/ui/airline-display/airline-display.component.ts:7
Component API
Inputs
The airline operator name (e.g., “Iberia”, “Ryanair”). Used as fallback text when no logo is available and displayed in the tooltip.
The ICAO code of the airline operator (e.g., “IBE”, “RYR”). Used to lookup the corresponding airline logo from the assets directory.
Width of the airline logo image in pixels.
Height of the airline logo image in pixels.
Display Logic
The component uses thegetAirlineDisplay() method to determine what to display:
-
Logo Mode: If the
operatorIcao(converted to uppercase) exists inlogos-list.json, returns: -
Text Mode: If no logo is found, returns:
src/app/features/flights/ui/airline-display/airline-display.component.ts:19-32
Template Behavior
The component template (airline-display.component.html:1-9) conditionally renders:
-
When logo exists: Displays an
<img>element with:- Dynamic
srcpointing to the airline logo - Configurable
widthandheight - Material tooltip showing the operator name
- Lazy loading enabled for performance
- Proper
alttext for accessibility
- Dynamic
- When logo unavailable: Displays the operator name as plain text (or “N/A” if operator is null)
Usage Examples
Basic Usage (Default Size)
Custom Size
Handling Missing Data
Dependencies
- CommonModule: For structural directives (
@if) - MatTooltipModule: For showing operator name on hover
- Assets: Requires
public/assets/airlines/logos-list.jsonand corresponding logo PNG files
Features
- Automatic logo detection based on ICAO code
- Graceful fallback to text display
- Configurable dimensions
- Material tooltip integration
- Lazy loading for logo images
- Accessibility-friendly with proper alt text
