abhilash reddy
abhilash reddy

Reputation: 1586

How to add form values of a component which are created using dynamic component loader?

I have a component which loads using DCL. I want to add the control group to parent form.I have made a plunker demo . I dont know how to bind the child control group to parent.

add() {
    this._dcl.loadIntoLocation(DynamicCmp, this._e, 'location').then((ref) => {
      ref.instance._ref = ref;
      ref.instance._idx = this.idx++;
      this._children.push(ref);
    });
}

And this is how i am adding components.Somebody please tell me how to add the child controls to the control in parent form

Upvotes: 2

Views: 152

Answers (1)

Vlado Tesanovic
Vlado Tesanovic

Reputation: 6424

I don't think that you can pass anything to DLC component or vice versa. What you can do, and i think it is handier solution to use:

 this.completeForm.addControl("sku", new Control)

Look at Plunker: http://plnkr.co/edit/MahOzQqkyv613N1NtElF?p=preview

Upvotes: 1

Related Questions