Class ViewContainerRefAbstract

Hierarchy (View Summary)

Constructors

Accessors

  • get anchorElement(): Element
  • Anchor element that specifies the location of this container in the containing view. Each view container can have only one anchor element, and each anchor element can have only a single view container.

    Root elements of views attached to this container become siblings of the anchor element in the rendered view.

    Access the ViewContainerRef of an element by placing a Directive injected with ViewContainerRef on the element, or use a ViewChild query.

    Returns Element

Methods

  • create component by tag name selector.

    Type Parameters

    • C extends {}

    Parameters

    • selector: string

      the tag name for the aurora custom-element

    • Optionaloptions: IndexOptions

    Returns C

  • create component by the aurora custom-element View Class

    Type Parameters

    • C extends {}

    Parameters

    • viewClass: Type<HTMLComponent<C>>

      the generated aurora view class

    • Optionaloptions: IndexOptions

    Returns C

  • Instantiates a single component and inserts its host view into this container.

    Type Parameters

    • C extends {}

    Parameters

    • componentType: Type<C>

      Component Type to use.

    • Optionaloptions: ViewContainerComponentOptions

      An object that contains extra parameters:

      • index: the index at which to insert the new component's host view into this container. If not specified, appends the new view as the last entry.
      • selector: the tag name of the new create component that attached with this model class. Any Model class can have many views with different selectors.

    Returns C

    The new HTMLComponent which contains the component instance and the host view.

  • Detaches a view from this container without destroying it. Use along with insert() to move a view within the current container.

    Parameters

    • Optionalindex: number

      The 0-based index of the view to detach. If not specified, the last view in the container is detached.

    Returns undefined | ViewRef

  • Destroys a view attached to this container

    Parameters

    • Optionalindex: number

      The 0-based index of the view to destroy. If not specified, the last view in the container is removed.

    Returns void