3

I am getting Cannot read property of undefined in angular 6 but its value is displaying in template.here is my code

  this.data.post_data('dashboard/gettodaydata','',true)
               .subscribe((data:any) => {
                 this.today_datas =data.data;
              });

and this is my template file

<span class="counter text-danger">{{ today_datas.total_cpc | number }}</span>

1 Answer 1

6

Binding is trying to get evaluate before today_datas gets populated from API call. Use navigation/elvis operator

{{ today_datas?.total_cpc | number }}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.