I have the current transform pipe, where the goal is to immediately delete any number from an input:
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'NumberKiller'})
export class NumberKiller implements PipeTransform {
transform(input: string): string {
return input.replace(/[0-9]/g, ''); //Immediately delete any number from the input
}
}
However, while it does delete any numbers from the input, it only does so once I make another input after I put in a number.
Example: if I were to input “AB1”
AB1 //Does not delete the 1, and will also not delete any number if I input more numbers afterwards
Then, if I were to input “AB1C”
ABC //once I enter any non number input, the 1 gets deleted as well as any other number in the input
I want to have it so that the number gets immediately deleted once I try to input it. Any suggestions on how this could be done? I have a feeling it’s something simple, but I can’t seem to figure it out.