UNPKG

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.

54 lines (53 loc) 3.54 kB
import { Injector, EnvironmentInjector } from '@angular/core'; import { Observable } from 'rxjs'; import { HookIndex, ParseResult } from '../interfacesPublic'; import { ParseOptions } from './settings/options'; import { TextHookFinder } from './core/textHookFinder'; import { ComponentCreator } from './core/componentCreator'; import { DynamicHooksSettings } from './settings/settings'; import { HookParserEntry } from './settings/parserEntry'; import { SettingsResolver } from './settings/settingsResolver'; import { ContentSanitizer } from './utils/contentSanitizer'; import { AutoPlatformService } from './platform/autoPlatformService'; import { ElementHookFinder } from './core/elementHookFinder'; import * as i0 from "@angular/core"; /** * The core service for the ngx-dynamic-hooks library. Provides the main logic internally used by all components. */ export declare class DynamicHooksService { private allSettings; ancestorSettings: DynamicHooksSettings[] | null; private moduleSettings; private settingsResolver; private textHookFinder; private elementHookFinder; private contentSanitizer; private componentCreator; private platformService; private environmentInjector; private injector; constructor(allSettings: DynamicHooksSettings[] | null, ancestorSettings: DynamicHooksSettings[] | null, moduleSettings: DynamicHooksSettings | null, settingsResolver: SettingsResolver, textHookFinder: TextHookFinder, elementHookFinder: ElementHookFinder, contentSanitizer: ContentSanitizer, componentCreator: ComponentCreator, platformService: AutoPlatformService, environmentInjector: EnvironmentInjector, injector: Injector); /** * Parses content and loads components for all found hooks * * @param content - The content to parse * @param parsers - An optional list of parsers to use instead of the global ones * @param context - An optional context object * @param options - An optional list of options * @param globalParsersBlacklist - An optional list of global parsers to blacklist * @param globalParsersWhitelist - An optional list of global parsers to whitelist * @param targetElement - An optional HTML element to use as the container for the loaded content. * @param targetHookIndex - An optional object to fill with the programmatic hook data. If none is provided, one is created and returned for you. * @param environmentInjector - An optional environmentInjector to use for the dynamically-loaded components. If none is provided, the default environmentInjector is used. * @param injector - An optional injector to use for the dynamically-loaded components. If none is provided, the default injector is used. */ parse(content?: any, parsers?: HookParserEntry[] | null, context?: any, options?: ParseOptions | null, globalParsersBlacklist?: string[] | null, globalParsersWhitelist?: string[] | null, targetElement?: HTMLElement | null, targetHookIndex?: HookIndex, environmentInjector?: EnvironmentInjector | null, injector?: Injector | null): Observable<ParseResult>; /** * Cleanly destroys all loaded components in a given HookIndex * * @param hookIndex - The hookIndex to process */ destroy(hookIndex: HookIndex): void; static ɵfac: i0.ɵɵFactoryDeclaration<DynamicHooksService, [{ optional: true; }, { optional: true; }, { optional: true; }, null, null, null, null, null, null, null, null]>; static ɵprov: i0.ɵɵInjectableDeclaration<DynamicHooksService>; }