I have seen that some browsers localize the input type=\"number\"
notation of numbers.
So now, in fields where my application displays longitude and la
I don't know if this helps but I stumbled here when searching for this same problem, only from an input point of view (i.e. I noticed that my was accepting both a comma and a dot when typing the value, but only the latter was being bound to the angularjs model I assigned to the input).
So I solved by jotting down this quick directive:
.directive("replaceComma", function() {
return {
restrict: "A",
link: function(scope, element) {
element.on("keydown", function(e) {
if(e.keyCode === 188) {
this.value += ".";
e.preventDefault();
}
});
}
};
});
Then, on my html, simply: will substitute commas with dots on-the-fly to prevent users from inputting invalid (from a javascript standpoint, not a locales one!) numbers. Cheers.