I tried to fix the undefined error by setting the object property value to an empty string but its still giving the error as mentioned below:
ERROR TypeError: Cannot read property 'notes' of undefined
TS
let notes;
if (typeof manufacturer_field.manufacturer_guidelines[0].notes == undefined){
notes = '';
} else {
notes = manufacturer_field.manufacturer_guidelines[0].notes;
}
HTML
<p *ngIf="field.notes?.length">{{field.notes}}</p>
I referred this answer but that didn't work: How to handle 'undefined' in javascript