Моя таблица использует чипы для ввода значения в поле «тип». но когда в нем нет ценностей. в нем все еще есть пустой чип. Кто-нибудь знает, как я могу решить эту проблему?
[![html
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef mat-sort-header="type">Type</th>
<td mat-cell *matCellDef="let truck" class="pr-24">
<mat-chip-list>
<span *ngFor="let truck of truck.type.split(',')">
<mat-chip>{{truck}}</mat-chip>
</span>
</mat-chip-list>
</td>
</ng-container>][1]][1]
component.ts
import { Component, OnInit, ViewChild, ElementRef, Input, OnChanges } from '@angular/core';
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatChipsModule, MatChipInputEvent } from '@angular/material';
import { SelectionModel } from '@angular/cdk/collections';
import { Truck } from '../truck';
import { MapsAPILoader } from '@agm/core';
import { TruckDetailComponent } from '../truck-detail/truck-detail.component';
import { PlannerProject } from 'app/services/planner-projects/planner-project';
import { TrucksService } from '../trucks.service';
import { map, debounceTime, distinctUntilChanged, tap } from 'rxjs/operators';
import * as _ from 'lodash';
import { fromEvent } from 'rxjs';
import { ConfirmComponent } from 'app/shared/components/confirm/confirm.component';
import { FuseConfirmDialogComponent } from '@fuse/components/confirm-dialog/confirm-dialog.component';
import { MyDialogComponent } from 'app/main/delivery-orders/my-dialog/my-dialog.component';
import {COMMA, ENTER} from '@angular/cdk/keycodes';
@Component({
selector: 'app-trucks',
templateUrl: './trucks.component.html',
styleUrls: ['./trucks.component.scss']
})
export class TrucksComponent implements OnInit, OnChanges {
@Input() project: PlannerProject;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
selection: SelectionModel<Truck>;
_displayColumns: string[] = ['selectCol', 'truckSize', 'truckBuildUp', 'truckName', 'type', 'address', 'shift', 'maxWeight', 'maxVolume', 'actions'];
_dataSource: MatTableDataSource<Truck>;
@ViewChild('search') search: ElementRef;
projectData: string;
constructor(private mapsLoader: MapsAPILoader,
private _matDialog: MatDialog,
private truckService: TrucksService) { }
То есть в строке должна отображаться пустая область без фишек, если нет данных