getContext
function
stable
If inside an embedded view (e.g. *ngIf or *ngFor), retrieves the context of the embedded
view that the element is part of. Otherwise retrieves the instance of the component whose view
owns the element (in this case, the result is the same as calling getOwningComponent).
getContext
T | nullIf inside an embedded view (e.g. *ngIf or *ngFor), retrieves the context of the embedded
view that the element is part of. Otherwise retrieves the instance of the component whose view
owns the element (in this case, the result is the same as calling getOwningComponent).
@paramelement
ElementElement for which to get the surrounding component instance.
@returns
T | nullJump to details