Angular 6 - ERROR TypeError: Cannot read property 'value' of undefined

 I can't belive that a single   '?'    ruined my day that's why i'm creating this post . i'll try to make this as simple as i can.

This happens becuse one of your object does'n have the value untill the API response arrives.So use  ? to check untill the response arrives

for example:

question: this.pollForm.get("question")?.value

Comments

Popular posts from this blog

VS CODE UNABLE TO CHANGE USER SETTINGS - HOW TO FIX IT

Day 2: Loops :- 10 Days Of Javascript HackerRank Solution

Node.js module not found error -how to fix it