HTML dropdown with ng-options binding does not wor

2019-08-31 04:20发布

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>

1条回答
乱世女痞
2楼-- · 2019-08-31 04:59
<select ng-model="selectedOptionId">
        <option value="">Select Option</option>
        <option ng-repeat="o in myOptions" value="{{o.id}}">
                    {{o.DisplayText}}
        </option>
</select>

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.

查看更多
登录 后发表回答