I am wondering if the below code is fine in terms of performance.
in html
<button [disabled]="isDisabled()">btn</button>
in ts (component)
isDisabled(): boolean {
//...some loop calculation
console.log('run isDisabled');
return result;
}
The isDisabled method is executed all the time even you just scroll down the web browoser.
In the official Angular
A property name or method call should be the norm.
I can see that calling method is allowed but I feel it's kind of wasting specially there is a loop logic.
Can I keep using calling a method in [disabled] attribute in html or is there better way ?
Thanks.