首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ng-show没有任何影响

ng-show没有任何影响
EN

Stack Overflow用户
提问于 2017-08-16 16:17:19
回答 1查看 54关注 0票数 1

我有一个尝试使用ng-show的基本示例。如果从国家/地区下拉框中选择了'GB‘,我实际上只想显示页面的一部分。我已经验证了,当我从下拉框中选择GB时,ctrl会在其中接收'GB‘。但是,元素最初不会隐藏在页面上,并且从选择框中选择内容没有任何影响。如果能帮上忙我会很感激的。

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

发布于 2017-08-17 20:04:49

替换此行

代码语言:javascript
复制
<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" />

像这样

代码语言:javascript
复制
<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" ></select>

select中的自关闭在angular中不起作用,我希望它能有所帮助!!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45708472

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档