Skip to content

Commit

Permalink
fix(portal): correct return type of TemplatePortal.attach (angular#14602
Browse files Browse the repository at this point in the history
)

Fixes angular#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.
  • Loading branch information
mina-skunk authored and RudolfFrederiksen committed Jun 21, 2019
1 parent 9a0d2d7 commit 7a1584f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cdk/portal/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;

Expand All @@ -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);
}
Expand Down

0 comments on commit 7a1584f

Please sign in to comment.