ngx-dynamic-hooks
Version:
Automatically insert live Angular components into a dynamic string of content (based on their selector or any pattern of your choice) and render the result in the DOM.
65 lines (64 loc) • 2.83 kB
TypeScript
import { AfterViewInit, OnDestroy, OnChanges, ElementRef, DoCheck, AfterViewChecked, EventEmitter, SimpleChanges, ComponentRef } from '@angular/core';
import { ParseResult } from '../interfacesPublic';
import { HookParser } from '../interfacesPublic';
import { DynamicHooksService } from '../services/dynamicHooksService';
import { ComponentUpdater } from '../services/core/componentUpdater';
import { AutoPlatformService } from '../services/platform/autoPlatformService';
import { ParseOptions } from '../../public-api';
import * as i0 from "@angular/core";
export interface DynamicHooksSingleOptions {
updateOnPushOnly?: boolean;
compareInputsByValue?: boolean;
compareOutputsByValue?: boolean;
compareByValueDepth?: number;
ignoreInputAliases?: boolean;
ignoreOutputAliases?: boolean;
acceptInputsForAnyProperty?: boolean;
acceptOutputsForAnyObservable?: boolean;
}
/**
* A component that can be used to dynamically load a single component and pass bindings to it
*/
export declare class DynamicSingleComponent implements DoCheck, OnChanges, AfterViewInit, AfterViewChecked, OnDestroy {
private hostElement;
private platformService;
private dynamicHooksService;
private componentUpdater;
component: (new (...args: any[]) => any) | null;
inputs: {
[key: string]: any;
};
outputs: {
[key: string]: any;
};
options: DynamicHooksSingleOptions;
componentLoaded: EventEmitter<ComponentRef<any>>;
parseResult: ParseResult | null;
parseOptions: ParseOptions;
constructor(hostElement: ElementRef, platformService: AutoPlatformService, dynamicHooksService: DynamicHooksService, componentUpdater: ComponentUpdater);
ngDoCheck(): void;
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewInit(): void;
ngAfterViewChecked(): void;
ngOnDestroy(): void;
/**
* Destroys the dynamic component and resets the state
*/
reset(): void;
/**
* Loads the dynamic component
*/
loadComponent(): void;
/**
* Creates a parser specifically for the dynamic component
*
* @param selector - The selector to use for the component
*/
createAdHocParser(selector: string): (new (...args: any[]) => HookParser);
/**
* Updates the bindings for the loaded component
*/
refresh(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicSingleComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicSingleComponent, "ngx-dynamic-single", never, { "component": { "alias": "component"; "required": false; }; "inputs": { "alias": "inputs"; "required": false; }; "outputs": { "alias": "outputs"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, { "componentLoaded": "componentLoaded"; }, never, never, true, never>;
}