I have an object in Angular2 as below:
userDetails = {"userId":23,"first_name":"Rajesh","last_name":"Kumar"}
Now whenever I try to print value of userDetails.first_name in html file then there is an error on browser
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'first_name' of undefined.
Please help me to understand the root cause.
Your object userDetails is not Defined, that is why you are getting this error , try to console the value of userDetails & check whether it's returning empty value or not. Do share your response.