I need to get Dot (.) written on an input whenever Comma (,) is pressed for decimal input and not text. I need somehow to simulate Keypress or KeyDown programmatic.
I tried all the answers here but none of them worked:
I wrote the following directive code for an input:
app.directive('ngKommatopoint', function() {
return {
link : function($scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 188) {
element.trigger(
$.Event( 'keydown', { keyCode:190,which:190})
);
}
});
},
restrict: 'A'
}; });
This solution doesn't work because it never calls "Dot" event. Any idea why it doesn't work?