使用Angularjs更改多选元素

时间:2017-04-21 13:58:12

标签: angularjs model-view-controller

我的页面中有一个多选元素。

 $scope.MainWinnerFilterSelected = @Html.Raw(Json.Encode(Model.SelectedWinner));

我可以先用下面的代码加载

 $scope.loadReasonAndWinner= function() {
        var productGroupFilters=$scope.productGroupFilterSelected;
        var res = $http.post('@Url.Action("GetWinnerAndReasonList", "Details")', {'selectedProductGroup':productGroupFilters});
        res.success(function(data, status) {
            $scope.MainWinnerFilters=data.WinnerList;
            $scope.MainReasonFilters=data.NotInterestingReasonList;
        });
        res.error(function(data, status) {
            $scope.addError("alert-danger","Bir Hata oluştu.","Error");
        });

    }

我想用新数据重新加载这个元素,但它很有效。

    [HttpPost]
    public ActionResult GetWinnerAndReasonList(int SelectedProductGroup)
    {
        var detail = new DetailsModel();
        detail.SelectedProductGroup = SelectedProductGroup;
        var winnerList = BiddingService.RetrieveWinners(null, VariableHelper.ListOf(detail.SelectedProductGroup));
        detail.WinnerList = BiddingService.TranslateToFilter(winnerList);

        var notInterestedActionStatus = new List<int>() { VariableHelper.Int(ActionStates.NotInterested) };
        var notInterestingReasonList = BiddingService.RetrieveActionReason(notInterestedActionStatus, VariableHelper.ListOf(detail.SelectedProductGroup));
        detail.NotInterestingReasonList = BiddingService.TranslateToFilter(notInterestingReasonList);

        return Json(detail);
    }

在控制器中;

{{1}}

新数据实现并且它与combobox(MainReasonFilter)一起使用,但它更改了多选元素(MainWinnerFilter)中的项目。有什么想法?

0 个答案:

没有答案