Overview
TheLandingComponent creates a dynamic landing page that displays a collection of navigation icons loaded from the application configuration. It supports both standard routing and query parameter-based navigation, making it flexible for various navigation patterns in the PWA.
Component metadata
Component selector used in templates
This component is standalone with explicit imports
Path to the component template
Path to the component styles
Required imports:
RouterLink for navigation functionalityInputs
Optional input to specify which landing page configuration to load. If not provided, defaults to
PAGE_ANGULAR_DEMO_LANDING from the environment configuration.Properties
Array of nested page objects containing navigation data including icons, routes, and query parameters. Each page object is enhanced with a
queryParamsObj property after parsing.Constructor dependencies
Service for loading and accessing application configuration including page data
Methods
ngAfterViewInit()
Angular lifecycle hook that triggers the landing page loading after the view is initialized.loadLandingPage()
Loads the landing page configuration and processes nested page data.- Calls
configService._loadMainPages()to ensure configuration is loaded - Retrieves page data from
_environment.mainPageListDictionary - Uses
LandingPageinput if provided, otherwise defaults to configured page name - Loads
pages_nestedarray from the configuration - Transforms each page by parsing query parameter strings into objects
parseQueryParams()
Parses query parameter strings into AngularParams objects for routing.
Query parameter string to parse (e.g.,
"{key1: 'value1', key2: 'value2'}")Params object with parsed key-value pairs
Features:
- Validates input string
- Removes curly braces, quotes, and extra whitespace
- Splits into key-value pairs
- Returns empty object for invalid input
- Includes debug logging for invalid inputs
Template structure
The component template renders a centered, animated grid of navigation icons:- Uses Angular’s
@forcontrol flow syntax - Conditionally renders links with or without query parameters
- Each icon is 45px wide with right margin spacing
- Centered alignment with animation class
Usage examples
- Basic usage
- With custom page
- In standalone component
Page object structure
Each page in_pages_nested contains:
Image source URL for the navigation icon
Router link path (used when query parameters are present)
Direct URL path (used when no query parameters)
Raw query parameter string to be parsed
Parsed query parameters object (added by
parseQueryParams)Initialization flow
- Component is instantiated with
ConfigServiceinjected ngAfterViewInit()lifecycle hook is calledloadLandingPage()is invoked- Configuration is loaded asynchronously via
configService._loadMainPages() - Page name is determined from
LandingPageinput or configuration - Nested pages array is retrieved and processed
- Each page’s query parameters are parsed and added as
queryParamsObj - Template renders navigation icons with appropriate routing
Routing strategies
The component supports two routing approaches:With query parameters
Without query parameters
Error handling
Includes validation and warnings:Source location
- TypeScript:
~/workspace/source/src/app/_components/landing/landing.component.ts - Template:
~/workspace/source/src/app/_components/landing/landing.component.html - Styles:
~/workspace/source/src/app/_components/landing/landing.component.css