mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Jeremy Elbourn
parent
99f3c2d974
commit
70bc4d56e1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user