UNPKG

1.73 kBTypeScriptView Raw
1import { ModuleWithProviders, ComponentRef, TemplateRef, ComponentFactoryResolver, ViewContainerRef } from '@angular/core';
2import { Portal, TemplatePortal, ComponentPortal, BasePortalHost } from './portal';
3/**
4 * Directive version of a `TemplatePortal`. Because the directive *is* a TemplatePortal,
5 * the directive instance itself can be attached to a host, enabling declarative use of portals.
6 *
7 * Usage:
8 * <template portal #greeting>
9 * <p> Hello {{name}} </p>
10 * </template>
11 */
12export declare class TemplatePortalDirective extends TemplatePortal {
13 constructor(templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef);
14}
15/**
16 * Directive version of a PortalHost. Because the directive *is* a PortalHost, portals can be
17 * directly attached to it, enabling declarative use.
18 *
19 * Usage:
20 * <template [portalHost]="greeting"></template>
21 */
22export declare class PortalHostDirective extends BasePortalHost {
23 private _componentFactoryResolver;
24 private _viewContainerRef;
25 /** The attached portal. */
26 private _portal;
27 constructor(_componentFactoryResolver: ComponentFactoryResolver, _viewContainerRef: ViewContainerRef);
28 portal: Portal<any>;
29 /** Attach the given ComponentPortal to this PortlHost using the ComponentFactoryResolver. */
30 attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
31 /** Attach the given TemplatePortal to this PortlHost as an embedded View. */
32 attachTemplatePortal(portal: TemplatePortal): Map<string, any>;
33 /** Detatches the currently attached Portal (if there is one) and attaches the given Portal. */
34 private _replaceAttachedPortal(p);
35}
36export declare class PortalModule {
37 static forRoot(): ModuleWithProviders;
38}