Skip to content

Commit

Permalink
write value directly to model on init
Browse files Browse the repository at this point in the history
  • Loading branch information
mareczek committed Dec 21, 2015
1 parent afe9925 commit 2805551
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions releases/international-phone-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
numberType: "MOBILE",
onlyCountries: void 0,
preferredCountries: ['us', 'gb'],
skipUtilScriptDownload: false,
utilsScript: ""
}).directive('internationalPhoneNumber', [
'$timeout', 'ipnConfig', function($timeout, ipnConfig) {
Expand Down Expand Up @@ -65,10 +66,10 @@
if (newValue[0] !== '+') {
newValue = '+' + newValue;
}
element.val(newValue);
ctrl.$modelValue = newValue;
}
element.intlTelInput(options);
if (!(attrs.skipUtilScriptDownload !== void 0 || options.utilsScript)) {
if (!(options.skipUtilScriptDownload || attrs.skipUtilScriptDownload !== void 0 || options.utilsScript)) {
element.intlTelInput('loadUtils', '/bower_components/intl-tel-input/lib/libphonenumber/build/utils.js');
}
return watchOnce();
Expand Down
4 changes: 2 additions & 2 deletions releases/international-phone-number.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/international-phone-number.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ angular.module("internationalPhoneNumber", [])
if newValue[0] != '+'
newValue = '+' + newValue

element.val newValue
ctrl.$modelValue = newValue

element.intlTelInput(options)

Expand All @@ -81,7 +81,7 @@ angular.module("internationalPhoneNumber", [])
watchOnce()

)

scope.$watch('country', (newValue) ->
if newValue != null && newValue != undefined && newValue != ''
element.intlTelInput("selectCountry", newValue)
Expand Down

0 comments on commit 2805551

Please sign in to comment.