I have implemented a filter/search functionality on tables in Angular 6. I'm using this ng-2-search-filter library.
The functionality works perfectly in the front-end, and causes no console errors.
When I run an ng build "--prod" the library is causing build errors in the output, everywhere I have used the filter.
Error:
Property 'filter' does not exist on type 'x.component'.
I've imported the library in the app.module.ts appservices and @ngModule imports.
The library is also in the package.json as version "ng2-search-filter": "^0.4.7".
The input for the filter on the html is as follows:
<input type="text" class="form-control" [(ngModel)]="filter">
and used in the *ngFor as follows:
<tr *ngFor="let item of items| filter:filter};">
The only solutions I can find are in relation to the RxJS filter. I've imported the library individually into each component that uses filter, but that has no impact.
Sorry, the error lay in the component, I didn't initialize any variable 'filter', didn't realize I should have as no errors were thrown.