我需要做电话掩码(999) 999-9999
,就像这个例子http://angular-ui.github.io/ui-utils/但对于 Ionic 移动应用程序输入。
ui-utils 在裸 AngularJS 应用程序中工作正常:http://plnkr.co/edit/NozbdhtRjaxq1KFYrwLo?p=preview
<body ng-controller="MainCtrl">
<input type="text" ng-model="phonenumber" ui-mask="(999) 999-9999">
</body>
但是,这不适用于 Ionic:http://codepen.io/hawkphil/pen/qdxOLW?editors=101
<input type="text" placeholder="First Name" ui-mask="(999) 999-9999" ng-model="attendee.firstname">
占位符被劫持什么的。如何修复占位符?
然后,当我输入一些数字时,一切都困惑了,并且注入(inject)了一些占位符文本。如何修复?
或者,我不需要仅仅为了一件事而使用 ui-utils。 Ionic 有手机 mask 替代品吗?
type=tel
对我不起作用,因为它只弹出数字键盘而没有其他内容。
我确实需要显示占位符“输入电话号码”。所以显示 (___) ___ ____ 是行不通的
最佳答案
尝试<input type="text" placeholder="First Name" ui-mask="(999) 999-9999" ng-model="attendee.firstname" ui-mask-placeholder>
。插件的“ui-mask-placeholder”理解这一点很重要。
关于javascript - ui-utils 手机 mask 不适用于 Ionic 输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31152892/