在Angular JS Kendo下拉不设置模型值
In Angular JS Kendo Drop down not setting the model value
嗨,我有以下 Kendo 下拉列表,即使我在 ng-model 中有一个值,下拉列表也不是 select 默认值。
<select name="myDropDown"
id="myDropDown"
class="width-90"
kendo-drop-down-list k-data-text-field="'key'"
k-data-value-field="'value'"
k-data-source="myDataSource"
ng-model="model.selectedProperty"></select>
model.selectedProperty 确实有值。但是 UI 没有 select 选项。
数据源值:
[{"key":"Critical","value":0},{"key":"High","value":1},{"key":"Medium","value":2},{"key":"Low","value":3}]
model.selectedProperty = 1
上面应该 select 编辑了第二个选项,但是下拉列表 selects none
好吧,我必须使 selected 值与列表中的对象相同:
$scope.model.selectedProperty = {"key":"Critical","value":0}
并且我将 select 标签更新为,
<select name="myDropDown"
id="myDropDown"
class="width-90"
ng-model="model.selectedProperty"
ng-options="option.key for option in myDataSource track by option.value">
</select>
嗨,我有以下 Kendo 下拉列表,即使我在 ng-model 中有一个值,下拉列表也不是 select 默认值。
<select name="myDropDown"
id="myDropDown"
class="width-90"
kendo-drop-down-list k-data-text-field="'key'"
k-data-value-field="'value'"
k-data-source="myDataSource"
ng-model="model.selectedProperty"></select>
model.selectedProperty 确实有值。但是 UI 没有 select 选项。
数据源值:
[{"key":"Critical","value":0},{"key":"High","value":1},{"key":"Medium","value":2},{"key":"Low","value":3}]
model.selectedProperty = 1
上面应该 select 编辑了第二个选项,但是下拉列表 selects none
好吧,我必须使 selected 值与列表中的对象相同:
$scope.model.selectedProperty = {"key":"Critical","value":0}
并且我将 select 标签更新为,
<select name="myDropDown"
id="myDropDown"
class="width-90"
ng-model="model.selectedProperty"
ng-options="option.key for option in myDataSource track by option.value">
</select>