嗨,我正在使用primeng 实现一个产品的粗略表,但我发现一个错误:对象可能是'null' 引用了一个事件,我该如何解决这个错误?
<p-table #dt [value]="products" [rows]="10" [paginator]="true" [globalFilterFields]="['product.nome']"
[(selection)]="selectedProducts" [rowHover]="true" dataKey="id"
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<div class="p-d-flex p-ai-center p-jc-between">
<h5 class="p-m-0">Manage Products</h5>
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="text" (input)="dt.filterGlobal($event.target.value, 'contains')" placeholder="Search..." /> <!--error here-->
</span>
</div>
</ng-template>
这里的错误
src/app/components/product/product.component.html:26:90 - error TS2531: Object is possibly 'null'.
26 <input pInputText type="text" (input)="dt.filterGlobal($event.target.value, 'contains')" placeholder="Search..." />//value is null
谢谢