cwill747 / angular-libphonenumber Goto Github PK
View Code? Open in Web Editor NEWnathanhammond/libphonenumber as an angular input mask
License: Other
nathanhammond/libphonenumber as an angular input mask
License: Other
bower install --save angular-libphonenumber
Should include both files with tools like gulp / wiredep
Currently it just includes
Add libphonenumber.js to main in bower.json
Some time i happen number in the input or i got a virtual keyboard who add number to the input.
How can we trigger this plugin on change?
Feel free to close when it’s out of scope.
Thanks for your attention!
In libphonenumber
, setting the country code works as a fallback. If I set the country code to BE
, it will try to parse numbers without an explicit country prefix as a Belgian number. If, however, I provide a Dutch phone number, as long as I include the Dutch prefix +31
, it will validate as well.
In angular-libphonenumber
, the country code takes precedence over the prefix. If I set the country code to BE
, only Belgian numbers ever validate. If I enter a Dutch phone number +31 6 12345678
, it will be marked as invalid.
It could be that I’ve overlooked a setting somewhere and this behaviour is already possible!
Otherwise, I haven’t yet looked into the internals of libphonenumber
and angular-libphonenumber
, so I’m not sure how easy it would be to reproduce libphonenumber
’s behaviour.
In https://run.plnkr.co/plunks/k32xZLSRS47w6TW3auAF/ set the country code to BE
and try to validate +31 6 12345678
.
The context is any application that is used by an organisation or company mainly active in one country, but who will occasionally deal with international users. These users might not have a national phone number, but they will be aware that they need to add their prefix. The national users will be entering their data in various forms, in many cases without the prefix.
I used the online demo available at: https://run.plnkr.co/plunks/k32xZLSRS47w6TW3auAF/
Any chance this could be published in the NPM registry?
Your current version 0.0.9 does not include the libphonenumber.full.js file, so when you install via bower you do not get that thing. You have to reference the commit directly which is quite dirty imho:
bower install angular-libphonenumber#672c4195a0b95692f94cf73cd6964762171c45f4
Please bump your version up so the current state (including libphonenumber.full.js) can be referenced by bower without dirty hacks.
Suppose I put br as country code and put a US number and then change the country code to US, it does not formats and validates the number
As a user I want the cursor to remain at the point of editing and not jump to the end while editing the numbers in between.
I am using it for number validation by region code it is working fine but for thailand number starting with 65 it is telling me the number is invalid but in actual it is valid.
Hey @cwill747, hope you're doing well.
Overview of the Issue and Motivation for or Use Case
Since v0.0.9 and more specifically this commit 195713a. I can't use this plugin since you removed some functionalities that I was using (including phoneUtils.formatE164
).
I naturally tried to used https://raw.githubusercontent.com/nathanhammond/libphonenumber/master/dist/libphonenumber.js directly but phoneUtils.formatAsTyped
is not defined in that file.
Angular libphonenumber Version(s)
0.0.9
Browsers and Operating System
is this a problem with all browsers? no
Suggest a Fix
phoneUtils.formatAsTyped
coming from?phoneUtils
export, we should at least be able to use the libphonenumber.js
from @nathanhammond/libphonenumber to use other functions, no? What do you think?Thanks for your help.
The CONTRIBUTING.md is missing from the repo based on the reference in the README.md
Overview of the Issue
When using the singapore country code ("sg") and entering 012345
, the backspace key works fine to remove the 5 but then got stuck and cannot remove 01234
.
Angular Version: v1.4.3
Angular libphonenumber Version: 0.0.7
Browsers and Operating System: Able to reproduce on chrome and on mobile devices via cordova
Reproduce the Error: just run the basic example with singapore country code, enter 012345 then try to delete.
Suggest a Fix: I was not able to isolate the part of the code yet.
Thanks for your help!
EDIT 1: By triming the returned value of the clean function, the problem disappears. Replace that line (https://github.com/cwill747/angular-libphonenumber/blob/master/src/phone-number.js#L91) by:
-return formattedValue;
+return formattedValue.trim();
Before opening a PR, I would like to know your thoughts on the issue and make sure it won't cause any regression. Thanks
Could You update the nathanhammond/libphonenumber in Your repo to the latest release ?
Pristine / dirty checking might be broken on last bower fix. Look into this.
You should be able to enter a phone number without the cursor jumping around,
When trying to add an area code the cursor jumps around
Hi,
thanks for your directive, very useful. Can the bower.json be changed so that angular is a devDependency not a dependency? I am using your directive with ionic which already import angular, that causes conflict.
Thanks
I would like to not receive console output for every number entered as I type a phone number
Either remove the line that outputs that the phone number is not valid, at least in the release versions, or add an option to not validate as I type similar to what you did with the formatter.
The cursor does not follow the formatting correctly.
As the number is formatted automatically the cursor should move to the end so new numbers can be inserted.
As the number is typed spaces are automatically inserted.
The cursor does not move to after the last inserted number. It remains in front and so the next number being added is inserted in front of the last.
Ensure that the cursor is always at the end of the number being typed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.