Overview
TheBaseComponent serves as a foundational layout component that provides common functionality for page title management, reference toggling, status messages with speech synthesis, and integration with backend services. It’s designed to be extended or used as a standalone component for pages requiring these core features.
Component metadata
Component selector used in templates
This component is standalone and can be used independently
Path to the component template
Path to the component styles
Properties
Public properties
The current page title displayed in the component. This property has both getter and setter methods for controlled access.
Controls the visibility state of the references list. Initially hidden.
The caption text for the toggle button. Changes between “[See references]” and “[Hide references]” based on
isListVisible state.Angular signal containing the current status message. Changes trigger speech synthesis through an effect.
Array of page references loaded from the environment configuration.
The internal page name retrieved from the environment configuration.
Constructor dependencies
The component injects several services:Service for loading configuration and page data
Service for backend operations including logging
Angular router service for accessing route parameters
Service for text-to-speech functionality
Injected token containing the page title key for configuration lookup
Methods
toggleList()
Toggles the visibility of the references list and updates the caption accordingly.- Inverts the
isListVisiblestate - Updates
toogleLisCaptionto “[See references]” when hidden or “[Hide references]” when visible - Speaks “See references” when the list becomes visible
Template usage
The component template is minimal, displaying only the page title:Usage example
- Template
- TypeScript
Initialization flow
- Effect registration: An effect is registered to monitor
status_messagesignal changes - Configuration loading:
configService._loadMainPages()is called asynchronously - Page data retrieval: Page data is fetched from
_environment.mainPageListDictionaryusing the injectedPAGE_TITLE_LOGkey - Title setting: The page title is set and spoken using the speech service
- Backend logging: The page title is logged to the backend
- References loading: If available, page references are loaded into
_pagesarray
Key features
Speech synthesis integration
The component automatically speaks:- The page title when initialized (in en-US locale)
- Status messages when they change (reactive effect)
- “See references” when the references list is shown
Signal-based reactivity
Uses Angular signals for thestatus_message property with an effect that:
Error handling
Includes graceful fallback when page data is not found:Source location
- TypeScript:
~/workspace/source/src/app/_components/base/base.component.ts - Template:
~/workspace/source/src/app/_components/base/base.component.html - Styles:
~/workspace/source/src/app/_components/base/base.component.css