I have input field in my template and I would like to catch each key press and update the value in the dom by removinf empty spaces - trim.
I can catch the event and the function I build is working correctly but the value in the input text field is not updated accordingly.
@HostListener('input', [ '$event.target.value' ])
input( value ) {
console.log('value! ' + value);
value = value.replace(/\s/gi, '');
console.log('value after trim ' + value);
return true;
}
Any idea?