使用ng-repeat选择列表有数据但没有以角度js显示

时间:2016-04-23 18:44:34

标签: angularjs wysiwyg

我正在使用表单中的选择列表以及wysiwyg angular-ui编辑器。 有时候选择列表工作正常,但有时候它没有显示。我已经调试,看它是否有正确的值。 代码如下:

var app = angular.module('RESTClient', ['colorpicker.module', 'wysiwyg.module']);
<select class="required_input_mandatory inputs" ng-model="OrganizationOption" ng-change="GetUsers()">
 <option value="0">Select</option>
 <option ng-repeat="o in OrganizationModel" value="{{o.ID}}">{{o.OrganizationName}}</option>
 </select>

select元素的HTML标记生成为

<select class="required_input_mandatory inputs ng-pristine ng-valid ng-not-empty ng-touched" ng-model="OrganizationOption" ng-change="GetUsers()">
    <option value="0">Select</option>
    <!-- ngRepeat: o in OrganizationModel -->
    <!-- ngRepeat: o in OrganizationModel -->
    <!-- end ngRepeat: o in OrganizationModel -->
    <!-- ngRepeat: o in OrganizationModel -->
    <!-- end ngRepeat: o in OrganizationModel -->
    <!-- ngRepeat: o in OrganizationModel -->
    <!-- end ngRepeat: o in OrganizationModel -->
    <!-- ngRepeat: o in OrganizationModel -->
    <!-- end ngRepeat: o in OrganizationModel -->

请帮帮我。

1 个答案:

答案 0 :(得分:1)

尝试使用ngOptions指令:

<select 
        class="required_input_mandatory inputs" 
        ng-model="OrganizationOption" ng-change="GetUsers()" 
        ng-options="o.ID as o.OrganizationName for o in OrganizationModel">
    <option>Select</option> 
</select>