Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x | import { AsyncPipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { map } from 'rxjs'; import type { Observable } from 'rxjs'; import { USER$ } from '@app/core/user.token'; import type { MaybeUser } from '@app/core/user.token'; import { SpinnerComponent } from '@app/shared/spinner/spinner.component'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, imports: [ AsyncPipe, SpinnerComponent ], selector: 'app-dashboard', styleUrl: './dashboard.component.scss', templateUrl: './dashboard.component.html', }) export class DashboardComponent { public readonly name$: Observable<string>; constructor() { const user$ = inject(USER$); this.name$ = user$.pipe( map((maybeUser: MaybeUser): string => maybeUser?.displayName ?? 'You'), ); } } |