Recently, I've been working on creating a filter pipe that can filter by numbers. This is because I want to use it to filter job postings based on salary. Although I successfully created a filter for string characters, I'm unsure about how to handle filtering by numbers as I am still new to this concept.
Check out my filter pipe code below:
import { Pipe, PipeTransform } from '@angular/core';
import { Jobs } from '../interfaces/jobs.interface';
@Pipe({
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) {
resultPosts.push(jobs);
};
};
return resultPosts;
}
}
I have a question regarding the usage of 'jobs.salary'. Can anyone guide me on which specific method I should be using in this context?