Chartjs-Could not find elementById on mat-card-content

1👍

Probably when you try to get it, it is not on the page. Components are javascript objects. So you need to get element after it loaded. I don’t recommend the below solution. You should do it when component initialized.

Try this to validate my assumption:

setTimeout(() => {  
    console.log(document.getElementById("chart"))  
}, 5000); // 5 seconds to make sure  

Leave a comment