I want to obtain similar result to https://stackoverflow.com/a/49680194 but in my case it dosen't work valid. The only difference is boolean
variable. Can you explain me what I'm doing wrong?
Below the code listing:
export class SomeComponent {
enabled: boolean = false;
toggle() {
if(this.enabled === true) {
this.enabled = false;
} else {
this.enabled = true;
}
}
}
And html template:
<button (click)="toggle()">{{enabled}}</button> <!-- updates only one time (false -> true) -->
<div>{{enabed}}</div> <!-- works correctly -->