A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.
Optional
containerOptional
custom
Component
FlexibleGrid
A dynamic, highly customizable grid component that renders a specified number of rows and columns, with each grid item containing a provided component. Supports full template customization and style overrides.
Description
FlexibleGrid offers three levels of customization to fit your application's needs:
containerStyle
to modify grid appearanceng-template
viacustomTemplate
for complete controlKey Features:
Selector
app-flexible-grid
Standalone
true
Imports
CommonModule
Example
Basic Usage:
Example
Style Customization:
Example
Custom Template Override:
Input
customWidth - Width for each grid item in pixels. Default: 0
Input
customHeight - Height for each grid item in pixels. Default: 0
Input
rows - Number of rows in the grid. Default: 0
Input
columns - Number of columns in the grid. Default: 0
Input
componentsToRender - Array of components to render in the grid, each with optional inputs
Input
backgroundColor - Background color for each grid item. Default: 'transparent'
Input
containerStyle - Custom CSS styles for the grid container
Input
customTemplate - Custom ng-template for complete grid layout override
Method
ngOnInit - Initializes and generates the grid on component load
Method
ngOnChanges - Regenerates the grid if columns, componentsToRender, or rows change
Method
generateGrid - Builds the grid based on the row, column, and component configurations
Method
getGridItemStyle - Returns a style object for each grid item
Method
createInjector - Creates a cached injector for each component to support dynamic inputs