It is good practice to use signals in templates and bad practice to use methods.
But signals and methods?
Example (using the get method from Map):
userStatuses: WritableSignal<Map<string, string>> = signal(new Map([ ['Alice', 'offline'], ['Bob', 'online'] ])); <div *ngIf="userStatuses().get('Alice') === 'offline'" class="offline-message"> ⚠️ **ALERT:** Alice is currently offline! </div> It's better to use a computed signal like:
isAliceOffline = computed(() => { const status = this.userStatuses().get('Alice'); return status === 'offline'; }); <div *ngIf="isAliceOffline()" class="offline-message"> ⚠️ **ALERT:** Alice is currently offline! Which approach performs best and why?