title: Angular template variable with calculation
body: <p>In angularjs you could do:</p>
  
  <pre><code>&lt;div ng-controller="ExampleController"&gt;
    &lt;div ng-init="a=1 + 5 -2"&gt;{{a}}
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>//a = 4   </p>
  
  <p>Whats the equivalent in angular 5/6/7?
  I have a ngFor loop with number, and I need to present at the bottom the total number.</p>
  
  <pre><code>@Component({
    selector: 'my-app',
    template: `
    &lt;div *ngFor="let i of arr"&gt;{{random()}}&lt;/div&gt;
    &lt;b&gt;Total: _____?&lt;/b&gt;
    `,
    styleUrls: [ './app.component.css' ]
  })
  export class AppComponent  {
    arr = new Array(10)
    random(){
      return  Math.floor((Math.random()*10));
    }
    name = 'Angular';
  }
  </code></pre>
  
  <p><a href="https://stackblitz.com/edit/angular-ij5uxc" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-ij5uxc</a></p>
  
  <p>Thanks</p>