1

我需要(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">

在此处输入图像描述

  1. 占位符被劫持或什么的。如何修复占位符?

  2. 然后当我输入一些数字时,一切都搞砸了,并在其中注入了一些占位符文本。怎么修?

  3. 或者,我不需要仅将 ui-utils 用于一件事。Ionic 是否有任何手机面罩替代品?type=tel对我不起作用,因为它只弹出数字键盘,没有别的。

我确实需要显示占位符“输入电话号码”。所以显示 (___) ___ ____ 是行不通的

4

1 回答 1

0

试试<input type="text" placeholder="First Name" ui-mask="(999) 999-9999" ng-model="attendee.firstname" ui-mask-placeholder>。插件的“ui-mask-placeholder”理解这一点很重要。

于 2015-10-01T03:12:21.053 回答