X Tutup
Skip to content

DynamicComponentLoader.loadIntoNewLocation: Should be usable with any ElementRef ... #2472

@matanlurey

Description

@matanlurey

not just with a component's ElementRef.

For example:

@Directive()
class ReferenceDirective {
  ReferenceDirective(DynamicComponentLoader dcl, ElementRef ref) {
    dcl.loadIntoNewLocation(... ref) // Throws right now
  }
}

Workaround:

var elementInjector = internalView(elementRef.parentView)
    .elementInjectors[elementRef.boundElementIndex];
var hostComponentElementRef = elementInjector.getHost()
    .getElementRef();

I'm denoting P3, because there is a simple enough workaround that can be hidden away in a utility class, but I may bump if others run into the same issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup