Home:ALL Converter>how to create a filter pipe by number in angular

how to create a filter pipe by number in angular

Ask Time:2022-08-03T10:35:18         Author:Junior-Dev-Night

Json Formatter

i want to create a filter pipe, which i can filter by number, because I will use it to filter by salary. I created the filter for string characters, but I don't know how it would be with numbers, because I'm new in this.

here is my pipe

import { Pipe, PipeTransform } from '@angular/core';
import { Jobs } from '../interfaces/jobs.interface';

  name: 'filterSalary'
export class FilterSalaryPipe implements PipeTransform {

  transform(value: Array<Jobs>, arg: any): any {
    const resultPosts = [];
    for (const jobs of value) {
      if (jobs.salary.indexOf(arg) > -1) {
    return resultPosts;

in the jobs.salary what method, am i supposed to use?

Author:Junior-Dev-Night,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73215722/how-to-create-a-filter-pipe-by-number-in-angular