title: Filter in NodeJs, Angular and Express is not filtering the results
body: <p>I have a route that I use to filter some data</p>
  
  <pre><code>import {Request, Response} from 'express';
  import {MODELS} from "./db-data";
  import {setTimeout} from "timers";
  
  
  
  export function searchModel(req: Request, res: Response) {
  
      const queryParams = req.query;
  
      const modelId = queryParams.modelId,
            filter = queryParams.filter || '',
            sortOrder = queryParams.sortOrder || 'asc',
            pageNumber = parseInt(queryParams.pageNumber) || 0,
            pageSize = parseInt(queryParams.pageSize) || 3;
  
      let models:any = Object.values(MODELS).sort((l1:any, l2:any) =&gt; l1.id - l2.id);
  
      models = models.filter(model =&gt; model.title.trim().toLowerCase().search(filter.toLowerCase()) &gt;= 0);
  
      if (sortOrder == "desc") {
          models = models.reverse();
      }
  
      const initialPos = pageNumber * pageSize;
  
      const modelsPage = models.slice(initialPos, initialPos + pageSize);
  
      setTimeout(() =&gt; {
          res.status(200).json({payload: modelsPage});
      },1000);
  
  
  }
  </code></pre>
  
  <p>MODELS is an object like this</p>
  
  <pre><code>export const MODELS: any = {
  
      0: {
          id: 0,
          title: "test1",
          category: 'category1',
          longDescription: "Lorem ipsum"
      },
      ....
      ....
  </code></pre>
  
  <p>Then in my server.ts file:</p>
  
  <pre><code>app.route('/api/models').get(searchModel);
  </code></pre>
  
  <p>In the client side i have a component and I'm using RxJs to filter the results like this:</p>
  
  <pre><code>export class RepositoryComponent implements OnInit, AfterViewInit {
  
    modelList$: Observable&lt;Model[]&gt;;
    @ViewChild('searchInput', { static: true }) input: ElementRef;
  
    constructor() { }
  
    ngOnInit() {
      setRxJsLoggingLevel(RxJsLoggingLevel.TRACE);
    }
  
    ngAfterViewInit() {
      this.modelList$ = fromEvent&lt;any&gt;(this.input.nativeElement, 'keyup')
        .pipe(
            map(event =&gt; event.target.value),
            startWith(''),
            debug( RxJsLoggingLevel.TRACE, "search "),
            debounceTime(400),
            distinctUntilChanged(),
            switchMap(search =&gt; this.loadModels(search)),
            debug( RxJsLoggingLevel.DEBUG, "lessons value ")
        );
    }
  
    loadModels(search = ''): Observable&lt;Model[]&gt; {
      return createHttpObservable(`/api/models?pageSize=100&amp;filter=${search}`)
      .pipe(
          map(res =&gt; res["payload"])
      );
    }
  
  }
  </code></pre>
  
  <p>The observer is working propertly and it returns all models correctly. But if i try to filter the query like typing "test1" :</p>
  
  <pre><code>http://localhost:4200/api/models?pageSize=100&amp;filter=test1
  </code></pre>
  
  <p>It's not working and it returns always all models. I can't figure it out</p>