【问题标题】:AngularJS: ng-intl-tel-input - How to get updated value?AngularJS:ng-intl-tel-input - 如何获取更新的值?
【发布时间】:2016-01-22 05:30:35
【问题描述】:

AngularJS - 我正在使用第三方插件 ng-intl-tel-input。这是用于电话/手机号码展示。一切都很好,根据国旗的变化填充占位符(例如电话号码)。在这里,我面临的问题是,如果根据国家/地区代码输入的值不正确且号码无效。它返回null..我想验证并需要以有效号码显示用户并需要更新的号码..我怎么得到?

<input class="form-control" type="text" ng-model="mobile" ng-intl-tel-input>

【问题讨论】:

  • 你能不能把它弄出来。
  • 您如何在表单上显示无效输入错误?
  • @ranakrunal9 目前我需要显示..通常我正在使用 js 验证..如果输入的字段为空则显示通知

标签: angularjs


【解决方案1】:

您可以从以下网址查看演示

http://hodgepodgers.github.io/ng-intl-tel-input/

和来自以下 URL 的 html 源代码

https://github.com/hodgepodgers/ng-intl-tel-input/blob/master/index.html

尝试更改下面的输入代码。

<form name="form">
    <div class="form-group" ng-class="{'has-error': form.mobile.$invalid && form.mobile.$touched, 'has-success': form.mobile.$valid}">
        <input type="text" class="form-control" id="mobile" name="mobile" ng-model="mobile" ng-intl-tel-input>
        <span class="help-block" ng-show="form.mobile.$pristine && form.mobile.$untouched">Please type a telephone number</span>
        <span class="help-block" ng-show="form.mobile.$invalid && form.mobile.$touched">Invalid :(</span>
        <span class="help-block" ng-show="form.mobile.$valid">Valid :)    </span>
    </div>
</form>

【讨论】:

  • 感谢您的回答@ranakrunal9。我可以在观看或点击时获得用户更新价值吗?使用这个插件
  • 抱歉,我没有收到您要观看或点击的内容?
猜你喜欢
  • 2019-08-22
  • 2016-05-30
  • 2019-09-27
  • 2019-06-24
  • 1970-01-01
  • 2016-01-20
  • 1970-01-01
  • 1970-01-01
  • 2021-04-10
相关资源
最近更新 更多