【问题标题】:options aren't showing in my select tag | Angular and Ionic选项未显示在我的选择标签中 |角度和离子
【发布时间】:2017-06-13 11:02:10
【问题描述】:

我想显示我的选项(category.name for category in categories):

<div class="row" style="margin-bottom:15px;padding:0;padding-top:0px;padding-bottom:0px;">
<div class="col col-white" style="height:45px;background-color:#EDEEF1;padding-top:6px">
    <div class="list" style="max-width:80%;margin-left:10%">
        <label class="item item-input item-select" style="border:none;padding:0;border-radius:25px;color:black">
            <div class="input-label" style="color:grey; margin-left:auto; margin-right:auto;z-index:9999">
                {{selectedCategory.name.name ? selectedCategory.name.name : 'Välj kategori'}}
            </div>
            <select ng-click="test()" id="helloo" ng-model="selectedCategory" ng-options="category.name for category in categories">
                <option selected value="">Välj kategori</option>
            </select>
        </label>
    </div>
</div>

但由于某种原因,它们不会显示。我四处询问,有人说这与一些 innerHTML 有关,其他人说这是我的 CSS 造成的。感觉这个bug没有办法解决!!

但是,当我检查元素时,我可以使用 Chrome 开发工具看到我的所有选项标签,但在我的浏览器中看不到。

非常感谢我能得到的所有帮助!

【问题讨论】:

  • 请添加控制器代码

标签: javascript jquery html css angularjs


【解决方案1】:

使用category.name.name 代替category.name

<select ng-change="test()" ng-model="selectedCategory" 
 ng-options="category.name.name for category in categories">
   <option selected value="">Välj kategori</option>
</select>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-21
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 2020-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多