Angular: DynamicComponentLoader loadIntoLocation no funciona correctamente en 2.0.0.beta.1

Creado en 11 ene. 2016  ·  3Comentarios  ·  Fuente: angular/angular

 Error during instantiation of AppComponent!.
There is no component directive at element [object Object]

Funciona en la versión beta.0:
http://plnkr.co/edit/p6w6bBZfkvXIdDabc1vI?p=preview
Está roto en la versión beta.1:
http://plnkr.co/edit/3Gn9ZuyMHUdlRqEmqVF7?p=preview

Comentario más útil

Según los cambios de ruptura

Component view is not yet created when component constructor is called. -> use onInit lifecycle callback to access the view of a component

Entonces, mover su código a ngOnInit funciona correctamente

    ngOnInit() {
      this.dcl.loadIntoLocation(ChildComponent, this.elementRef, 'child');
    }

Todos 3 comentarios

Según los cambios de ruptura

Component view is not yet created when component constructor is called. -> use onInit lifecycle callback to access the view of a component

Entonces, mover su código a ngOnInit funciona correctamente

    ngOnInit() {
      this.dcl.loadIntoLocation(ChildComponent, this.elementRef, 'child');
    }

@ericmartinezr Gracias.

Este problema se ha bloqueado automáticamente debido a la inactividad.
Por favor, presente un nuevo problema si se encuentra con un problema similar o relacionado.

Obtenga más información sobre nuestra política de bloqueo automático de conversaciones .

_Esta acción ha sido realizada automáticamente por un bot._

¿Fue útil esta página
0 / 5 - 0 calificaciones