Call TypeScript function in HTML without a click event
<p>I know how to call a TypeScript when clicking a button, but how do you call a function without that type of event? I would like to call a function when I have an array called chartData populated. This is what I have:</p>

<pre><code>        &lt;div *ngIf="chartData.length"&gt;
            chartMethod();
        &lt;/div&gt;
</code></pre>

<p>But instead of <code>chartMethod()</code> being called, it just prints 'chartMethod()' on the html page. </p>

<p>I've also tried:</p>

<pre><code>            &lt;script&gt; 
                chartTest();
            &lt;/script&gt;
</code></pre>

<p>but the function was still not called.</p>