I have the following code in my .ts file.
yourInfoData: IYourInfoData; //IYourInfoData is my constructor
getYourInfoData() {
$this = this;
$this.yourInfoData = yourInfoDataResponse; //yourInfoDataResponseis my response from service.
}
yourInfoDataResponsestructure is as follows:
yourInfoDataResponse{
"firstName" : "Xyz",
"lastName" : "Abc"
}
Can I access this.yourInfoData directly to bind with html input value as below :
<input type="text" [(ngModel)]="yourInfoData.firstName">
Doing so, I am getting an error
Cannot find firstName of undefined.
Can someone point to me what am I missing here. Or, is there other way to achieve this.
"): YourInfoComponent@6:47 ; Zone: angular ; Task: Promise.then ; Value: