src/app/dynamic-components.ts
This registry hold all the loading functions for components that can be used dynamically with lazy loading.
Methods |
|
Public add | |||||||||
add(key: string, mapping: T)
|
|||||||||
Inherited from
Registry
|
|||||||||
Defined in
Registry:17
|
|||||||||
Parameters :
Returns :
void
|
Public addAll | ||||||
addAll(tuples: [])
|
||||||
Inherited from
Registry
|
||||||
Defined in
Registry:31
|
||||||
Parameters :
Returns :
void
|
Public allowDuplicates |
allowDuplicates()
|
Inherited from
Registry
|
Defined in
Registry:49
|
Calling this will allow the same keys to be added multiple times without thrown errors. This is useful for storybook where live-updates re-trigger the decorator while the registry is cached.
Returns :
void
|
Public get | ||||||
get(key: string)
|
||||||
Inherited from
Registry
|
||||||
Defined in
Registry:35
|
||||||
Parameters :
Returns :
T
|
import { Type } from "@angular/core";
import { Registry } from "./core/config/registry/dynamic-registry";
export type AsyncComponent = () => Promise<Type<any>>;
/**
* This registry hold all the loading functions for components that can be used dynamically with lazy loading.
*/
export class ComponentRegistry extends Registry<AsyncComponent> {}
// TODO make a build script that looks for annotations and creates this
export const componentRegistry = new ComponentRegistry();
export type ComponentTuple = [string, AsyncComponent];