2

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

3
  • I'm also curious to know the answer. Been trying since you posted here. But nothing is working out. Commented Jan 21, 2016 at 7:21
  • 1
    @micronyks Thank you for your spending your valuable time.Here is the updated plunker plnkr.co/edit/hOqzUkrYOIyWYkploJ4q?p=preview. I got the values of child form added to parent using the ref when component is created.Now i am trying to destroy the control from parent when individual or all the components are disposed Commented Jan 21, 2016 at 12:33
  • Oh great answer. Yes remove method removes it. but doesn't remove it from completeForm. Commented Jan 21, 2016 at 12:46

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.