UNPKG

@swimlane/ngx-charts

Version:

Declarative Charting Framework for Angular

81 lines (80 loc) 2.64 kB
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injector, Type } from '@angular/core'; /** * Injection service is a helper to append components * dynamically to a known location in the DOM, most * noteably for dialogs/tooltips appending to body. * * @export * @class InjectionService */ export declare class InjectionService { private applicationRef; private componentFactoryResolver; private injector; static globalRootViewContainer: ComponentRef<any>; /** * Sets a default global root view container. This is useful for * things like ngUpgrade that doesn't have a ApplicationRef root. * * @param container */ static setGlobalRootViewContainer(container: ComponentRef<any>): void; private _container; constructor(applicationRef: ApplicationRef, componentFactoryResolver: ComponentFactoryResolver, injector: Injector); /** * Gets the root view container to inject the component to. * * @returns {ComponentRef<any>} * * @memberOf InjectionService */ getRootViewContainer(): ComponentRef<any>; /** * Overrides the default root view container. This is useful for * things like ngUpgrade that doesn't have a ApplicationRef root. * * @param {any} container * * @memberOf InjectionService */ setRootViewContainer(container: any): void; /** * Gets the html element for a component ref. * * @param {ComponentRef<any>} componentRef * @returns {HTMLElement} * * @memberOf InjectionService */ getComponentRootNode(componentRef: any): HTMLElement; /** * Gets the root component container html element. * * @returns {HTMLElement} * * @memberOf InjectionService */ getRootViewContainerNode(): HTMLElement; /** * Projects the bindings onto the component * * @param {ComponentRef<any>} component * @param {*} options * @returns {ComponentRef<any>} * * @memberOf InjectionService */ projectComponentBindings(component: ComponentRef<any>, bindings: any): ComponentRef<any>; /** * Appends a component to a adjacent location * * @template T * @param {Type<T>} componentClass * @param {*} [options={}] * @param {Element} [location=this.getRootViewContainerNode()] * @returns {ComponentRef<any>} * * @memberOf InjectionService */ appendComponent<T>(componentClass: Type<T>, bindings?: any, location?: Element): ComponentRef<any>; }