UNPKG

2.35 kBTypeScriptView Raw
1import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injector, ViewContainerRef, Type } from '@angular/core';
2/**
3 * Injection service is a helper to append components
4 * dynamically to a known location in the DOM, most
5 * noteably for dialogs/tooltips appending to body.
6 *
7 * @export
8 */
9export declare class InjectionService {
10 private applicationRef;
11 private componentFactoryResolver;
12 private injector;
13 static globalRootViewContainer: ViewContainerRef;
14 /**
15 * Sets a default global root view container. This is useful for
16 * things like ngUpgrade that doesn't have a ApplicationRef root.
17 *
18 * @param container
19 */
20 static setGlobalRootViewContainer(container: ViewContainerRef): void;
21 private _container;
22 constructor(applicationRef: ApplicationRef, componentFactoryResolver: ComponentFactoryResolver, injector: Injector);
23 /**
24 * Gets the root view container to inject the component to.
25 *
26 * @memberOf InjectionService
27 */
28 getRootViewContainer(): ViewContainerRef | ComponentRef<any>;
29 /**
30 * Overrides the default root view container. This is useful for
31 * things like ngUpgrade that doesn't have a ApplicationRef root.
32 *
33 * @param container
34 *
35 * @memberOf InjectionService
36 */
37 setRootViewContainer(container: ViewContainerRef): void;
38 /**
39 * Gets the html element for a component ref.
40 *
41 * @param componentRef
42 *
43 * @memberOf InjectionService
44 */
45 getComponentRootNode(component: ViewContainerRef | ComponentRef<any>): HTMLElement;
46 /**
47 * Gets the root component container html element.
48 *
49 * @memberOf InjectionService
50 */
51 getRootViewContainerNode(component: ViewContainerRef | ComponentRef<any>): HTMLElement;
52 /**
53 * Projects the bindings onto the component
54 *
55 * @param component
56 * @param options
57 *
58 * @memberOf InjectionService
59 */
60 projectComponentBindings(component: ComponentRef<any>, bindings: any): ComponentRef<any>;
61 /**
62 * Appends a component to a adjacent location
63 *
64 * @param componentClass
65 * @param [options={}]
66 * @param [location]
67 *
68 * @memberOf InjectionService
69 */
70 appendComponent<T>(componentClass: Type<T>, bindings?: any, location?: any): ComponentRef<any>;
71}