EmbeddedViewRef insertEmbeddedView(TemplateRef templateRef, int index)

Instantiates an Embedded View based on the TemplateRef `templateRef` and inserts it into this container at the specified index.

If index is not specified, the new View will be inserted as the last View in the container.

Returns the ViewRef for the newly created View.

Source

EmbeddedViewRef insertEmbeddedView(TemplateRef templateRef, int index) {
  EmbeddedViewRef viewRef = templateRef.createEmbeddedView();
  insert(viewRef, index);
  return viewRef;
}