title: ngOnInit variable wont show up on template end
body: <p>I have the following code in my app component:</p>
  <pre><code>import { Component } from '@angular/core';
  
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
  })
  
  export class AppComponent {
    title = 'Day1';
    public today;
      
    ngOnInit() {
  
      function counter() {
        this.today = new Date();
      }
      
      setInterval(counter, 1000);
    }
  }
  </code></pre>
  <p>and my HTML template is:</p>
  <pre><code>&lt;div class=&quot;clocklocation&quot;&gt;{{today | date:'shortTime'}}&lt;/div&gt;
  </code></pre>
  <p>Everything works fine if <strong>today = new Date();</strong> is not wrapped in any kind of function. What am I doing wrong here? Are functions not allowed in this form in Angular?</p>