如何将格式化掩码应用于输入字段 [英] How to apply Formatted Mask to a input filed
问题描述
我想将格式蒙版"应用于我的输入框.在这里,我有用于美元货币的jsFidle,但是我不需要更改美元,而是要更改Soles(S/.),为此我已经覆盖了 $ locale
.
I want to apply Formatted Mask to my input box. Here I have jsFidle for Doller currency, But instead of doller I need to change Soles(S/.), For that I have overriden the $locale
.
这是我在jsfidle中覆盖的代码.
this is the code i have overiden in jsfidle.
$locale.NUMBER_FORMATS.CURRENCY_SYM = S/.
鞋底符号可见,但是在输入数字数量时有问题.
Soles symbol is visible but while entering number amount there is a problem.
这是实物.我不知道如何发布Fidle链接.有条件发布jsfidle.我在这里发布网址.请找到它. http://jsfiddle.net/ExpertSystem/xKrYp/
Here is the fidel. I dont know how to post fidle link. There is condition to post jsfidle. Here I am posting url. Please find it. http://jsfiddle.net/ExpertSystem/xKrYp/
更新:-我的要求是我希望在通过环回答案获得的价值之前有一个鞋底符号.即使ng-model也不是第一次起作用,但是我面临的问题是如果我编辑对它有影响的现有值我的ng模型.
UPDATE:- My requirement is I want a soles symbole before my value that is I achieved through annoop answer.Even ng-model is not effecting for the first time,But The problem I am facing with that is if I edit the existing value it is effecting to my ng-model.
我的第二个问题是我有两个文本框.在一个文本框中,我需要显示美元,而在第二个文本中,我需要显示鞋底符号.如果我在jsp页面中应用此脚本,我只会得到鞋底,而不会得到鞋底.如果我从jsp中删除该脚本,我只会得到鞋底而不是娃娃.
My second problem is I am having two text boxes.In one text box I need to show doller and second I need to show soles symbol. If I apply this script in my jsp page I am only getting soles, Not soles. If I Remove that script from jsp I am getting only soles not doller.
<script src="//code.angularjs.org/1.5.4/i18n/angular-locale_es-pe.js"></script>
推荐答案
您不需要覆盖,只需添加必要的语言环境,然后尝试即可.参见此小提琴.我尝试使用其他指令,希望对您有所帮助:)
You don't need to override, just include the necessary locale and then try. See this fiddle. I've tried with different directive, hope it helps :)
包括语言环境:
<script src="//code.angularjs.org/1.5.4/i18n/angular-locale_es-pe.js"></script>
更新了提琴手链接.
这篇关于如何将格式化掩码应用于输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!