I'm trying to load data via HTTP GET in one component and then I need to use this data in child component that loaded dynamically.
Here's the code:
ngOnInit(){
this.accountService.getPersonalInfo().subscribe(
response => {
this.Account = response.json();
this.dcl.loadIntoLocation(HeaderComponent, this.elementRef, 'header')
.then(compRef => {
compRef.instance.Account=this.Account;
}
);
}
);
}
In child component (HeaderComponent) I can use this.Account to get this data. Is there a better way to do this?