我是angularjs的新手。我正在使用kendo multiselect我在加载视图时默认添加数据。当我点击那个按钮时我有一个保存按钮我在该方法中调用了Success方法。
在该方法中,我试图将另一个数据替换为多选。范围正在更新,但多选文本框显示为空。没有显示数据。
$scope.Details.EmailIDs = [
{ "Selected": false, "Text": "sample1", "Value": "sample1@gamil.com" },
{ "Selected": false, "Text": "sample2", "Value": "Sample2@gmail.com" }
];
$scope.ButtonClick = function () {
$scope.Success();
}
$scope.Success = function ()
{
$scope.Details.EmailIDs = [
{ "Selected": false, "Text": "data1", "Value": "data1@jaajitech.com" },
{ "Selected": false, "Text": "data2", "Value": "data2@jaajitech.com"}
];
}
这是我的HTML代码
<select kendo-multi-select k-options="UserOptions" k-value-primitive="false" k-ng-model="Details.EmailIDs"></select>
<button class="k-button" ng-click="ButtonClick()">Save</button>
答案 0 :(得分:0)
你不是在添加替代值,而是添加像这样的用途
$scope.Success = function ()
{
$scope.Details.EmailIDs.push({ "Selected": false, "Text": "data1", "Value": "data1@jaajitech.com" });
$scope.Details.EmailIDs.push({ "Selected": false, "Text": "data2", "Value": "data2@jaajitech.com"});
}