Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the option "customPlaceholder" ? #22

Open
krysbzh opened this issue Mar 6, 2018 · 2 comments
Open

How to use the option "customPlaceholder" ? #22

krysbzh opened this issue Mar 6, 2018 · 2 comments

Comments

@krysbzh
Copy link

krysbzh commented Mar 6, 2018

Hello,
thank you very much for your directive, it works fine and it very easy to use.
I use many options in my case (nationalMode, allowDropdown, placeholderNumberType...) and it's awesome.
However, I need to customize the placeholder of my field and I don't know how to use the customPlaceholder option ?!

In the library intl-tel-input, he says that's a function...
customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) { return "e.g. " + selectedCountryPlaceholder; }

Could you tell me if it's possible to use it with your angularjs directive ?

Thanks in advance

@slavafomin
Copy link
Member

Hello! Thank you for your interest in this module!

I believe this function is not implemented on our side. However, the code should be pretty simple to figure out: https://github.com/betsol/ng-intl-tel-input/blob/master/src/scripts/module.js.

If you would manage to implement this function, I will be glad to assist you with the PR.

@krysbzh
Copy link
Author

krysbzh commented Mar 7, 2018

Thanks for your proposition.
In fact, I have found a solution to use this option !

My controller
var c = this; c.myPlaceHolder = function(selectedCountryPlaceholder, selectedCountryData) { return "Ex : " + selectedCountryPlaceholder; }
HTML
<input type="tel" id="mobilePhone" name="mobilePhone" ng-model="data.mobilePhone" intl-tel-input intl-tel-input-options="{allowDropdown:false, customPlaceholder: c.myPlaceHolder}" />

Best Regards
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants