fix(portal): correct return type of TemplatePortal.attach (#14602)

Fixes #14584

BREAKING CHANGE
The return type of `TemplatePortal.attach` previously had an incorrect signature:
`TemplatePortal<C>.attach(...): C`. This should actually have been `TemplatePortal<C>.attach(...): EmbeddedViewRef<C>`. The type has been corrected.
This commit is contained in:
William Lohan
2019-05-12 21:29:49 -07:00
committed by Jeremy Elbourn
parent 99f3c2d974
commit 70bc4d56e1
+2 -2
View File
@@ -116,7 +116,7 @@ export class ComponentPortal<T> extends Portal<ComponentRef<T>> {
/**
* A `TemplatePortal` is a portal that represents some embedded template (TemplateRef).
*/
export class TemplatePortal<C = any> extends Portal<C> {
export class TemplatePortal<C = any> extends Portal<EmbeddedViewRef<C>> {
/** The embedded template that will be used to instantiate an embedded View in the host. */
templateRef: TemplateRef<C>;
@@ -142,7 +142,7 @@ export class TemplatePortal<C = any> extends Portal<C> {
* When a context is provided it will override the `context` property of the `TemplatePortal`
* instance.
*/
attach(host: PortalOutlet, context: C | undefined = this.context): C {
attach(host: PortalOutlet, context: C | undefined = this.context): EmbeddedViewRef<C> {
this.context = context;
return super.attach(host);
}