ngx-dynamic
Version:
dynamic contents projection in Angular
52 lines (51 loc) • 1.18 kB
TypeScript
import { Compiler, SimpleChanges, ViewContainerRef, OnDestroy } from '@angular/core';
import { DynamicComponentOptions } from './options';
/**
* DynamicComponent is a directive to create dynamic component.
*
* Example:
*
* ```ts
* @Component({
* selector: 'my-app',
* template: `
* <div *dynamicComponent="template; context: self; selector:'my-component'"></div>
* `
* })
* export class AppComponent {
* self = this;
*
* template = `
* <div>
* <p>Dynamic Component</p>
* </div>`;
* }
* ```
*
* Result:
*
* ```html
* <my-component>
* <div>
* <p>Dynamic Component</p>
* </div>
* </my-component>
* ```
*
*/
export declare class DynamicComponentDirective implements OnDestroy {
private options;
private vcRef;
private compiler;
template: string;
selector: string;
context: any;
private component;
private moduleType;
private cmpType;
constructor(options: DynamicComponentOptions, vcRef: ViewContainerRef, compiler: Compiler);
private createComponentType();
private createNgModuleType(componentType);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
}