Reputation: 1596
I am loading a component using DCL.I want to pass an object into that component.. I have made a plunker demo http://plnkr.co/edit/QKlMNnjfrt8PyVnGdJG4?p=preview where AppComponent is the parent and this the object i want to pass information = {name:"Abhi", place:"Banglore"};
export class SomeComponent {
public childform: ControlGroup;
constructor(fbs: FormBuilder) {
this.childform = fbs.group({
'name': ['', Validators.required],
'place':['']
});
}
}
This is the child component...When ever new component loads i want to display the object passed in input box of child component.I have no idea how to pass the data from parent to child in DCL...Somebody please help me guys...
Upvotes: 1
Views: 90
Reputation: 658067
The ComponentRef provides a reference to the created component by it's instance
getter
loadIntoLocation(...).then(ref => {
ref.instance.someField = someValue;
}
See also this similar question How to call an event in parent component from child component which is loaded using DCL loadintolocation()
Upvotes: 2