带有 ng-options 绑定的 HTML 下拉菜单不适用于 angular-dart [英] HTML dropdown with ng-options binding does not work with angular-dart

查看:29
本文介绍了带有 ng-options 绑定的 HTML 下拉菜单不适用于 angular-dart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular-dart ng-options 似乎不起作用.

Angular-dart ng-options does not seems to be working.

  <select ng-model="selectedOption" ng-options="s.DisplayText for s in myOptions">
        <option value="">Select Option</option>
    </select>

推荐答案

<select ng-model="selectedOptionId">
        <option value="">Select Option</option>
        <option ng-repeat="o in myOptions" value="{{o.id}}">
                    {{o.DisplayText}}
        </option>
</select>

注意 selectedOptionId 是字符串,如果我们使用 myOption(type with id and DisplayText as properties) 作为模型,它将添加带有?"的新选项在 HTML 中.

Note that selectedOptionId is string, if we use myOption(type with id and DisplayText as properties) as model it will add new option with "?" in HTML.

这篇关于带有 ng-options 绑定的 HTML 下拉菜单不适用于 angular-dart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆