yuyang041060120 / ng2-validation

angular2 validation
https://yuyang041060120.github.io/ng2-validation/index.html
MIT License
612 stars 213 forks source link

Phone validation not working with greek country code #112

Open vlaxos713 opened 7 years ago

vlaxos713 commented 7 years ago

Hi,

It's my first ever comment on github, so apologies for any rules breaking.

I have used your library for a greek phone number validation, but unfortunately it doesn't work: <input id="contactNumber" name="contactNumber" type="text" [(ngModel)]="model.contactNumber" #contactNumber="ngModel" phone="GR"> whereas with "US" country it does.

After debugging your, and libphonenumber, code the "phone/validator.ts" calls the "isValidNumber()" function (with 1 parameter -> {phone: v, country}) which takes the following route: validate.js --> isValid() metadata.js --> getTypes() return metadata[9] -> this is undefined for 'GR', hence 'true' is returned

If i remove the '{ }' and call the 2 parameter overload of that method (such as below), it works.