In my template I'd like to check if a service is available to enable/disable a button. Now I figured I have 2 options:
template:
<button [disabled]="isServiceAvailable()"></button>
TS:
isServiceAvailable(): boolean {
return true;
}
or
template:
<button [disabled]="isServiceAvailable"></button>
TS:
get isServiceAvailable() {
return true;
}
Is there a performance difference between the 2? I know the first one is considered bad since the function will get called every time the change detection runs. Is this also true for the second option? Will the getter be executed every time, or is this a good solution?