diff --git a/bookie/src/app/sales/modifiers/modifiers.component.html b/bookie/src/app/sales/modifiers/modifiers.component.html index ffa93f1..c41fc96 100644 --- a/bookie/src/app/sales/modifiers/modifiers.component.html +++ b/bookie/src/app/sales/modifiers/modifiers.component.html @@ -1,6 +1,6 @@ - @for (item of list; track item) { + @for (item of list | async; track item.id) { {{ item.name }} diff --git a/bookie/src/app/sales/modifiers/modifiers.component.ts b/bookie/src/app/sales/modifiers/modifiers.component.ts index f9a32c0..7975b29 100644 --- a/bookie/src/app/sales/modifiers/modifiers.component.ts +++ b/bookie/src/app/sales/modifiers/modifiers.component.ts @@ -1,4 +1,5 @@ import { CdkScrollable } from '@angular/cdk/scrolling'; +import { AsyncPipe } from '@angular/common'; import { Component, Inject } from '@angular/core'; import { MatBadge } from '@angular/material/badge'; import { MatButton } from '@angular/material/button'; @@ -16,10 +17,20 @@ import { ModifierCategory } from '../../core/modifier-category'; selector: 'app-modifiers', templateUrl: './modifiers.component.html', styleUrls: ['./modifiers.component.css'], - imports: [CdkScrollable, MatDialogModule, MatTabsModule, MatChipsModule, MatBadge, MatCard, MatRipple, MatButton], + imports: [ + CdkScrollable, + MatDialogModule, + MatTabsModule, + MatChipsModule, + MatBadge, + MatCard, + MatRipple, + MatButton, + AsyncPipe, + ], }) export class ModifiersComponent { - list: ModifierCategory[] = []; + list: Observable; selected: Modifier[]; selectedIds: (string | undefined)[]; @@ -27,9 +38,7 @@ export class ModifiersComponent { @Inject(MAT_DIALOG_DATA) public data: { list: Observable; selected: Modifier[] }, ) { - this.data.list.subscribe((list: ModifierCategory[]) => { - this.list = list; - }); + this.list = data.list; this.selected = data.selected; this.selectedIds = this.selected.map((e) => e.id); }