I am trying to replace Japanese half-width characters to full-width
characters.
ウ -> ウ
So whenever a user types in half width, we have to convert to full width
automatically.
Obvious solution would be to design a directive to change the ngModel on
keypress. But we have a huge codebase and I was thinking maybe with
`@Hostlistener` would be able to change the value.
```
@HostListener('document:keyup', ['$event']) onKeydownHandler(event) {
if (event.target.hasAttribute('type')
&& event.target.attributes['type'].value === 'text') {
event.target.value = this.changeToFullWidth(event, event.target.value);
}
}
```
However with this `[(ngModel)]` is always one character behind and I know
this is because I am touching the HTML element directly.
Is there a way to do this ? Or will I have to go harder approach of adding
directive to each input tag in whole project?
Also asked here:
https://stackoverflow.com/questions/54542100/how-to-force-angular-2-ngmodel-change-after-changing-input-value-with-javasc
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.