This is really basic, but I'm drawing a blank. I'm using ngModel to two-way data-bind to a variable from an input, but I want the value to be transformed on keypress the Angular 2 way. I have pipe that I'm using in another location for the same variable that has the replacement I need. The pipe just converts a title into a string usable as a URL routing slug. I'm not worried about that part. The problem is that pipes don't work with ngModel
(as far as I can tell), so I have to do something else, and I can't remember what this is called.
When the user enters invalid characters (numbers, special characters) into a field, I need those characters cleared from both the field and the variable, immediately, so the user will never see them. What is this called, and how do I do it? I already used (keypress)
, but that didn't clear the characters immediately.