loadNextTo<T extends Object> method

ComponentRef<T> loadNextTo<T extends Object>(
  1. ComponentFactory<T> component, {
  2. Injector? injector,
})

Creates and loads a new instance of the component defined by component.

The returned ComponentRef is attached next to the current directive - assuming the current directive is a_ structural directive_ (i.e. is either in a <template> or is used *, such as *ngIf) -otherwise throws an UnsupportedError.

See also loadNextToLocation.

Implementation

ComponentRef<T> loadNextTo<T extends Object>(
  ComponentFactory<T> component, {
  Injector? injector,
}) =>
    throw UnsupportedError('Not used within a structural directive');