UI <select kendo-multi-select k-options="selectOptions" k-ng-model="selectedIds"></select>
控制器$scope.selectOptions = {
placeholder: "Select products...",
dataTextField://cannot understand what to put in here,
valuePrimitive: true,
autoBind: false,
}
我有一个如下的字符串数组;$scope.arrayOfStrings = ["abc", "def", "ghi","jkl"];
我希望这些字符串是我的选项。
请具体的答案,因为我是新的角度。
您应该使用k-data-source属性来指定多选的数据源。在这种情况下,您还应该省略dataTextField:
<div ng-controller="MyCtrl">
<select kendo-multi-select k-options="selectOptions" k-ng-model="selectedIds" k-data-source="arrayOfStrings"></select>
<p ng-show="selectedIds.length" style="padding-top: 1em;">Selected: {{ selectedIds }}</p>
</div>
<script>
angular.module("KendoDemos", [ "kendo.directives" ])
.controller("MyCtrl", function($scope){
$scope.arrayOfStrings = ["abc", "def", "ghi","jkl"];
$scope.selectOptions = {
placeholder: "Select products...",
valuePrimitive: true,
autoBind: false,
};
$scope.selectedIds = [ "abc", "def" ];
})
</script>
下面是一个现场演示:http://dojo.telerik.com/@ korchestrv/EMaji