hodgepodgers / ng-intl-tel-input

AngularJS 1.4.x module implementing intl-tel-input (https://github.com/Bluefieldscom/intl-tel-input)
MIT License
110 stars 111 forks source link

Changes so the ngModel validates the number on countrychange event. #97

Closed alexandru-chirica closed 7 years ago

alexandru-chirica commented 7 years ago

This is method of valdiating the number on countrychange event. This is in regards to issue #85 .

bighappyface commented 7 years ago

Please see https://github.com/hodgepodgers/ng-intl-tel-input/blob/master/CONTRIBUTING.md

Please make adjustments to the source code in the repository root, not the dist directory.

Pramatta commented 7 years ago

Hello all, I have done the necessary changes , now if the old country's phone number's length is less than new selected country's phone number length, then only my model will get updated. or else the same issue still exists. Dont know if I have missed something.

I tried with changing

angular.element($window).on('countrychange', function () { if(attr.selectedCountry) { setSelectedCountryData(attr.selectedCountry); } if (!ctrl.$viewValue || ctrl.$viewValue === elm.val()) { return; } ctrl.$setViewValue(elm.val()); });

Also,

if (attr.selectedCountry) { setSelectedCountryData(attr.selectedCountry); angular.element($window).on('countrychange', handleCountryChange); scope.$on('$destroy', cleanUp); }

but in both the cases same issue. I have downgraded "intl-tel-input" to 7.0.2. Is that is stopping this?