Cannot read property of ‘xxx’ of undefined

The view is loaded before billItem is set.

You could use a safe navigation operator ?.

<ion-input text-right type="text" [value]="billItem?.BillNo" readonly></ion-input> //billItem model has BillNo property

or set it to empty object in the constructor of bill-details.ts:

constructor(...){
  if(! this.billItem){
    this.billItem={}
  }
}

Leave a Comment