It's a simple Angular4 application. I am calling a method using interpolation. It's getting executed 4 times.
app.component.ts
import { Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 1;
testing(){
console.log('IN testing 0');
}
private testing1(){
console.log('IN testing 1');
}
}
app.component.html
<h2>{{testing1()}}</h2>
<button (click)="testing()">Testing2 </button>
When the page is loaded it prints "IN testing 1" 4 times. When I click the button it prints "IN testing 1" twice. I am not able to understand the flow.