Есть массив:
Products = [{ id: 1, name : 'product 1', price : 100,
category: 'category_1' },
{ id: 2, name : 'product 2' , price : 700, category:
'category_2' },
{ id: 3, name : 'product 3', price : 300, category:
'category_3' }];
В него я хочу вставить дополнительный элемент :
this.Products.push(4, 'product 4', 400, 'category_1')
. Получаю в результате ошибку в методе push()
на id
вставляемого элемента - Argument of type '11' is not assignable to parameter of type.
Что не так делается, в чём ошибка?
<tr *ngFor="let item of Products">
<div *ngIf="item.id <= rows && item.category == this.category">
<div *ngIf="item.price <= 500" class="table table-striped">
<td>{{item.name}}</td>
<td>{{item.price}}</td>
<td>{{item.category}}</td>
<td><button class="btn btn-primary" id="but_Delete" (click)="delete(item.id)"> Удалить </button></td>
</div>
...