How to specify the LabelTemplate Kendo UI DropDownList option with AngularJS

It's hard for me to use the LabTTplateplate option in the dropdown using the angular options binding in KendoUI.

Version: Kendo UI v2015.1.430

Markup:

         <select kendo-drop-down-list
                k-options="DropDownOptionsTest"></select>

Script:

    var TestData = new kendo.data.ObservableArray([{value:"one", id:1}, {value:"two", id:2}]);
    $scope.DropDownOptionsTest = {
        dataSource: TestData,
        optionLabelTemplate: '<span>SelectText...</span>',
        dataTextField: "value",
        dataValueField: "id"
    };

Result: The parameter label is not displayed, the first option is automatically selected.

Can someone please explain to me why this does not work and how can I make it work?

+4
source share
1 answer

, , ( "SelectText..." ), , . optionLabel. optionLabelTemplate, , , . , :

$scope.DropDownOptionsTest = {
        dataSource: TestData,
        optionLabelTemplate: '<span>Select Text...</span>',
        dataTextField: "value",
        dataValueField: "id"
    };

:

$scope.DropDownOptionsTest = {
        dataSource: TestData,
        optionLabel: 'Select Text...'
        optionLabelTemplate: '<span>Select Text...</span>',
        dataTextField: "value",
        dataValueField: "id"
    };

, Label , optionLabelTemplate , , . , Label optionLabelTemplate - ( - , - ):

$scope.DropDownOptionsTest = {
        dataSource: $scope.testData,
        optionLabel: 'Select one...',
        optionLabelTemplate: function(optionLabel){return '<span>' + optionLabel + '</span>'},
        dataTextField: "value",
        dataValueField: "id"
    };
+5

All Articles