Skip to content Skip to sidebar Skip to footer

Angular2 Access Parent Component's @input Values

I'm trying to load a component dynamically using the ComponentResolver and ViewContainerRef services. The child component loads ok and the template is rendered. However i want to

Solution 1:

I think that you can leverage something like this:

this.compiler.resolveComponent(MyInputComponent).then((factory: ComponentFactory<any>) => {
   let component = this.target.createComponent(factory);
   component.instance.field = this.field;
});

See also the example https://plnkr.co/edit/bdGYvTf8y9LEw9DAMyN1?p=preview

Post a Comment for "Angular2 Access Parent Component's @input Values"