I'm facing an issue with a button that triggers the function 'SaveNewOpportunity' in my component file. When I click the button, I encounter the following error:
ERROR TypeError: Cannot read property 'grower' of undefined
Here is the HTML code for the button:
<button
mat-flat-button
color="accent"
(click)="saveNewOpportunity()"
[disabled]="isEdit">
Save </button>
And here is the corresponding Typescript code:
saveNewOpportunity() {
// Function logic here
}
Despite reviewing the code, I'm unable to identify the source of the error. The browser console displays the following message:
OpportunityComponent.html:734 ERROR TypeError: Cannot read property 'grower' of undefined
at OpportunityComponent.push../src/app/layout/opportunity/opportunity.component.ts.OpportunityComponent.saveNewOpportunity (opportunity.component.ts:772)
at Object.eval [as handleEvent] (OpportunityComponent.html:737)
at handleEvent (core.js:21652)