Fixed country code detection

Closes #914
This commit is contained in:
Igor Zhukov 2015-10-08 14:26:47 +03:00
parent 2a587f5c5f
commit dd4fdb2d87

View File

@ -101,11 +101,13 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}
function selectPhoneCountryByIso2 (countryIso2) {
var i, country;
for (i = 0; i < Config.CountryCodes.length; i++) {
country = Config.CountryCodes[i];
if (country[0] == countryIso2) {
return selectCountry({name: _(country[1] + '_raw'), code: country[2]});
if (countryIso2) {
var i, country;
for (i = 0; i < Config.CountryCodes.length; i++) {
country = Config.CountryCodes[i];
if (country[0] == countryIso2) {
return selectCountry({name: _(country[1] + '_raw'), code: country[2]});
}
}
}
return selectCountry({name: _('country_select_modal_country_us_raw'), code: '+1'});