我创建了一个 phoneInput 指令,它有一个用于选择所需国家代码的 ui-select 元素和一个用于电话号码的输入元素。
ui-select 元素如下所示:
<ui-select ng-model="selectedCountryPhone" ng-model-options="{updateOn: 'default'}">
<ui-select-match placeholder="{{'IMPORT_USERS.COUNTRY_PLACEHOLDER' | translate}}">
<span>{{$select.selected.phone}}</span>
</ui-select-match>
<ui-select-choices repeat="country.phone as country in (countries | filter: $select.search)" >
<span>{{country.name}}({{country.phone}})</span>
</ui-select-choices>
</ui-select>
我可以selectedCountryPhone
在指令中启动模型,但是当我尝试从列表中选择另一个国家时,它显示我已经选择了新的国家代码,但值selectedCountryPhone
仍然是初始值......