79678921

Date: 2025-06-25 10:59:50
Score: 2.5
Natty:
Report link
  1. What angular version are you using?

  2. Have you checked, if user is really written?

  3. Here would be some changes I would try without further context:

    Set changeDetection

    @Component({
        selector: 'app-header',
        standalone: true,
        imports: [RouterModule, NgIf],
        templateUrl: './header.component.html',
        styleUrl: './header.component.css',
        changeDetection: ChangeDetectionStrategy.OnPush, //Add changeDetection
    })
    

    Use @if instead of *ngIf since it's deprecated with angular 20.

    @if (user()) {
        <span>Olá, {{ user().name }}</span>
    } @else {
        <button class="button" routerLink="/login">Entrar</button>
    }
    
Reasons:
  • Blacklisted phrase (2): Olá
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What
  • Low reputation (0.5):
Posted by: Markus