我有一个尝试使用ng-show的基本示例。如果从国家/地区下拉框中选择了'GB‘,我实际上只想显示页面的一部分。我已经验证了,当我从下拉框中选择GB时,ctrl会在其中接收'GB‘。但是,元素最初不会隐藏在页面上,并且从选择框中选择内容没有任何影响。如果能帮上忙我会很感激的。
<ng-form name="directorsForm" cc-pitch-form="5" ng-controller="work.myCtrl as ctrl">
<div class="row cc-form__group">
<div class="columns large-3">
<label>Country</label>
</div>
<div class="columns large-3 left">
<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" />
</div>
</div>
<div ng-show="ctrl.selectedCountry =='GB'">
<div class="columns large-3">
<label>Enter address</label>
</div>
</div>
</ng-form>发布于 2017-08-17 20:04:49
替换此行
<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" />像这样
<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" ></select>select中的自关闭在angular中不起作用,我希望它能有所帮助!!
https://stackoverflow.com/questions/45708472
复制相似问题