Angular-Kendo ComboBox placeholder text not working

后端 未结 2 1646
小鲜肉
小鲜肉 2021-01-05 11:36

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 ? un

相关标签:
2条回答
  • 2021-01-05 12:01

    This is somewhat related to this issue: https://github.com/angular/angular.js/issues/1019

    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
        }
      }
    });
    

    (demo)

    0 讨论(0)
  • 2021-01-05 12:07

    If you are using <Select> instead of <input> you can use simple placeholder="'Project'"

    For example:

    <select kendo-combo-box="projectComboBox"
            k-data-source="projectDataSourceBox"
            k-data-text-field="'projectName'"
            k-data-value-field="'projectId'"
            k-ng-model="Dialog.ProjectId"
            k-value-primitive="true"                                        
            k-suggest="true"
            required="required"
            k-auto-bind="false"
            k-filter="'contains'"
            k-change="projectChangeBox"
            style="width: 100%"
            placeholder="'Project'">
            </select>
    
    0 讨论(0)
提交回复
热议问题