提问人:DaroGawlik 提问时间:3/26/2023 最后编辑:Uwe KeimDaroGawlik 更新时间:3/26/2023 访问量:35
Object 可以为 null。TS型
Object can be null. TS
问:
(成分 | 异步)。成分 -> 对象可能是 'null'.ngtsc(2531)
我在哪里使用任何方法来传递此错误?
<a class="list-group-item" style="cursor: pointer;"
*ngFor="let ingredient of (ingredients | async).ingredients; let i = index" (click)="onEditItem(i)"> {{ ingredient.name}} ({{ ingredient.amount}}) </a>
export class ShoppingListComponent implements OnInit, OnDestroy {
ingredients: Observable<{ ingredients: Ingredient[] }>;
private inChnageSub: Subscription;
constructor(
private slService: ShoppingListService,
private loggingService: LoggingService,
private store: Store<{ shoppingList: { ingredients: Ingredient[] } }>
) {}
ngOnInit(): void {
this.ingredients = this.store.select('shoppingList');
}
答: 暂无答案
评论