不工作角剑道组合框占位符文本 [英] Angular-Kendo ComboBox placeholder text not working
问题描述
我有一个页面上一个简单的角剑道组合框没有最初选择的值。它应该显示的<一个href=\"http://docs.telerik.com/kendo-ui/api/web/combobox#configuration-placeholder\"><$c$c>placeholder$c$c>文本在此情况下,而是它显示?未定义:未定义
I have a simple angular-kendo ComboBox on a page without an initially selected value. It should show the placeholder
text in that case, but instead it's showing ? undefined:undefined ?
HTML
<select kendo-combo-box ng-model="Project" k-options='projectOptions'></select>
JS
app.controller('MyCtrl', function($scope) {
$scope.projectData = [
{name: 'Bob', value: 1},
{name: 'Tom', value: 2}
];
$scope.projectOptions = {
placeholder: "'Select...'",
dataTextField: 'name',
dataValueField: 'value',
dataSource: {
data: $scope.projectData
}
}
});
下面是一个 plunker 显示的问题。任何人都可以找出原因在哪里?
Here's a plunker that shows the problem. Can anyone spot the cause?
这在使用旧版本的角剑道的工作,但它不是在当前版本中工作。
This used to work in an older version of angular-kendo, but it's not working in the current version.
推荐答案
这是有点关系这个问题:<一href=\"https://github.com/angular/angular.js/issues/1019\">https://github.com/angular/angular.js/issues/1019
This is somewhat related to this issue: https://github.com/angular/angular.js/issues/1019
解决方法很简单:使用&LT;输入&GT;
,而不是&LT;选择&GT;
元素:
The solution is simple: use an <input>
instead of a <select>
element:
<input kendo-combo-box ng-model="Project" k-options='projectOptions'/>
app.controller('MyCtrl', function($scope) {
$scope.projectData = [
{name: 'Bob', value: 1},
{name: 'Tom', value: 2}
];
$scope.projectOptions = {
placeholder: "'Select...'",
dataTextField: 'name',
dataValueField: 'value',
dataSource: {
data: $scope.projectData
}
}
});
(演示)
这篇关于不工作角剑道组合框占位符文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!