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

  • get length(): number
  • Reports how many views are currently attached to this container.

    Returns number

    The number of views.

Methods

  • Destroys all views in this container.

    Returns void

  • 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.

  • create an HTMLElement by tag name selector.

    Type Parameters

    • K extends keyof HTMLElementTagNameMap

    Parameters

    Returns HTMLElementTagNameMap[K]

  • create an HTMLElement by tag name selector.

    Type Parameters

    • K extends keyof HTMLElementDeprecatedTagNameMap

    Parameters

    Returns HTMLElementDeprecatedTagNameMap[K]

  • create HTMLElement by View Class reference

    Type Parameters

    • C extends HTMLElement

    Parameters

    Returns C

  • create a text node and insert to the view

    Parameters

    • data: string
    • Optionaloptions: IndexOptions

    Returns Text

  • 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

  • Retrieves a view from this container.

    Parameters

    • index: number

      The 0-based index of the view to retrieve.

    Returns undefined | ViewRef

    The ViewRef instance, or null if the index is out of range.

  • Returns the index of a view within the current container.

    Parameters

    • viewRef: ViewRef

      The view to query.

    Returns number

    The 0-based index of the view's position in this container, or -1 if this container doesn't contain the view.

  • Inserts a view into this container.

    Parameters

    • viewRef: ViewRef

      The view to insert.

    • Optionalindex: number

      The 0-based index at which to insert the view. If not specified, appends the new view as the last entry.

    Returns ViewRef

    The inserted ViewRef instance.

  • Moves a view to a new location in this container.

    Parameters

    • viewRef: ViewRef

      The view to move.

    • newIndex: number

      The 0-based index of the new location.

    Returns ViewRef

    The moved ViewRef instance.

  • 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

  • set the current views from this

    Parameters

    • views: ViewRef[]

      the new ViewRef list

    Returns void