I have a simple component parent-child to pass a parameter.
in parent component: i get values from http request in a service:
this.Service.getdataId(this.dataId).subscribe(
response => {
this.DataSource = response;
this.personid = response.PersonInfo.Id; // this is being bound to from template for @input parameter.
}
in my parent template, I have:
<app-view [personid ]="personId"></app-view>
in my child template:
@Input() personid : string = "";
my child template, never gets the value. BUT, is chrome dev tools, i can see that the value was given to the element:
app-view _ngcontent-iwk-c94="" _nghost-iwk-c93="" ng-reflect-personid="1da772c6-640f-456c-bba8-c25633">
So, I can see it there, but it is not assigned to the Input variable in my component. Further to this, the value is cut off for some reason, it is supposed to be a GUID, and the last 6 characters are cut off..i have not manipulation of this value anywhere. It goes from teh HTTPClient/Service -> Parent Component->Child Component.
EDIT: I hooked up the OnChange event. It seems like teh value i changing multiple times. I console log the value in the Onchange and it goes twice - once time the value i am expecting is there, the second time it is not. Hope someone can explain the situation to me?