Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
639 views
in Technique[技术] by (71.8m points)

Property 'value' does not exist on type 'FilterMetadata' on primeng table

I am migrating a module from primeng 7 to primeng11 along with angular11 the code runs perfectly fine on ng serve the functionalities are working too but on build I am getting a weird error

 error TS2339: Property 'value' does not exist on type 'FilterMetadata | FilterMetadata[]'.
  Property 'value' does not exist on type 'FilterMetadata'.

the error is for the below code

<input *ngIf='!col.noFilter' [style.width]="'98%'" [style.height]="'25px'" pInputText type="text"
                        [placeholder]="col.filterPlaceHolder ? col.filterPlaceHolder : ''" 
                        (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)" 
                        [value]="dt.filters[col.field]?.value" />
 

I have verified the primeng FilterMetaData interface and it has the property value like below

export interface FilterMetadata {
    value?: any;
    matchMode?: string;
    operator?: string;
}

the code syntax is fine i have veriified the same on primeng page docuemntation https://www.primefaces.org/primeng/showcase/#/table

Please kindly help not sure why ng serve has no ssues but build is failing. My node version is node v10.23.0

question from:https://stackoverflow.com/questions/65938954/property-value-does-not-exist-on-type-filtermetadata-on-primeng-table

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is a typo in your syntax. I hope you are using the global search functionality and the syntax should be (input)="dt.filterGlobal()" instead of (input)="dt.filter()".

<input *ngIf='!col.noFilter' [style.width]="'98%'" [style.height]="'25px'" pInputText type="text" [placeholder]="col.filterPlaceHolder ? col.filterPlaceHolder : ''" (input)="dt.filterGlobal($event.target.value, col.field, col.filterMatchMode) />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...