libs/age-range/src/enum-to-range.pipe.ts
name | enumToRange |
transform |
transform(value: any, _args?: any)
|
Defined in libs/age-range/src/enum-to-range.pipe.ts:10
|
Returns :
any
|
import { Pipe, PipeTransform } from '@angular/core';
import { ageRanges } from './age-ranges';
@Pipe({
name: 'enumToRange'
})
export class EnumToRangePipe implements PipeTransform {
transform(value: any, _args?: any): any {
try {
const index = parseInt(value, 10);
return ageRanges[index].label;
} catch (error) {
return null;
}
}
}