简体   繁体   English

如何使用ng-intl-tel-input指令获取国家/地区代码

[英]How to get country code with ng-intl-tel-input directive

How to get country code from input type in Angularjs 如何从Angularjs中的输入类型获取国家/地区代码

I am new in Angularjs, right now I have dropdown of country code + input type text (for mobile number), after a click on submit button, I am getting mobile number successfully but how can I get the country code as well? 我是Angularjs的新手,现在我有下拉国家代码+输入类型文本(手机号码),点击提交按钮后,我成功获得手机号码,但我怎样才能获得国家代码? Here is my HTML code 这是我的HTML代码

<input type="tel" class="form-control" id="tel" name="tel" 
       ng-model="updating.phone" ng-intl-tel-input numbers-only
       data-selected-country="selected.country" style="width:100%;">

Here is my script code 这是我的脚本代码

function getviewed()
{
    var form = new FormData();
    var numbr = document.getElementById('tel').value;
 }

Editors note: 编者注:

The GitHub for the ng-intl-tel-input directive is https://github.com/hodgepodgers/ng-intl-tel-input ng-intl-tel-input指令的GitHub是https://github.com/hodgepodgers/ng-intl-tel-input

尝试这个:

angular.element("#tel").intlTelInput.getSelectedCountryData()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM