LmnTemplateOutletDirective
Decorators: |
|
Generic types: | C |
Selectors: | [ |
Implements: |
|
An equivalent of ngTemplateOutlet directive but with the ability to provide the current Directive injector to the template. This is useful when you need to create the template that need to has access to the parent injector depending on the current concrete position into the dom.
Properties
Name | Type | Description |
---|---|---|
context r |
| A context object to attach to the {@link EmbeddedViewRef}. This should be an object, the object's keys will be available for binding by the local template |
injectorFn r |
| A function that receive as input the injector of current directive and must be return the Injector to use for the template. |
templateRef r |
| A string defining the template reference and optionally the context object for the template. |
Example usage
If you have a component that receive a template that represent an input radio, that request to access to the LMN_RADIO_GROUP token, with the Angular directive the parent injector of the template is inherit from the component that declare the template and break the component. With this directive instead the template receive as injector the current directive injector that is instantiated internally of input-radio-group component.