从列表中保存在角度js中不起作用

时间:2016-08-27 11:53:16

标签: angularjs

我在表中有一个重复的行。其中我有复选框列和文本列。我必须使用修改后的复选框保存整个重复列.List可以保持更改。但有时候保存功能会不是hit.can任何人帮助我做错了什么

  <tr ng-repeat="Screenrights in lstScreenAccessDetails">
                    <td class="txt-center" ng-bind="lstScreenAccessDetails[$index].ModuleName">
                    </td>
                    <td class="txt-center" ng-bind="lstScreenAccessDetails[$index].ScreenName">
                    </td>
                    <td class="txt-center">
                        <input type="checkbox" ng-model="lstScreenAccessDetails[$index].Create" />
                    </td>
                    <td class="txt-center">
                        <input type="checkbox" ng-model="lstScreenAccessDetails[$index].Edit" />
                    </td>
                    <td class="txt-center">
                        <input type="checkbox" ng-model="lstScreenAccessDetails[$index].Delete" />
                    </td>
                    <td class="txt-center">
                        <input type="checkbox" ng-model="lstScreenAccessDetails[$index].View" />
                    </td>
                </tr>

//保存

        $scope.Save = function () {
            debugger;
            var httpreq = {
                method: 'POST',
                url: 'ScreenAccessRights.aspx/Save',
                headers: {
                    'Content-Type': 'application/json; charset=utf-8',
                    'dataType': 'json'
                },

                data: { ROLEID: $scope.SelectedRole.RoleCode, SCREENLIST: $scope.lstScreenAccessDetails }

            }
            $http(httpreq).success(function (response) {

                alert("Saved Successfully.");

            })

        };


//Service

// SAVE         [System.Web.Services.WebMethod()]         public static List Save(字符串ROLEID,List SCREENLIST)         {             List lstScreenAccessDetails = new List();             尝试             {

            ResponseScreenAccessRights response = new ResponseScreenAccessRights();

            RequestScreenAccessRights request = new RequestScreenAccessRights();
            request.requestScreenAccessRightsEntity = new ScreenAccessRightsEntity();
            request.requestScreenAccessRightsEntity.RoleId = ROLEID;
            request.requestScreenAccessRightsEntity.lstScreenAccessDetails = SCREENLIST;
            request.requestScreenAccessRightsEntity.CreatedBy = "Admin";
            response = new ScreenAccessRightsBC().InsertScreenAccessRightsBC(request);

            if (response.result)
            {
                DataTable ds = response.dtScreenAccessRightsDetails;

                lstScreenAccessDetails = (from DataRow row in response.dtScreenAccessRightsDetails.Rows

                                          select new ScreenAccessDetails
                                          {
                                              ModuleId = row["MODULEID"].ToString(),
                                              ModuleName = row["MODULENAME"].ToString(),
                                              ScreenId = row["SCREENID"].ToString(),
                                              ScreenName = row["SCREENNAME"].ToString(),
                                              Create = Convert.ToBoolean(row["SCREENCREATE"]),
                                              Edit = Convert.ToBoolean(row["SCREENEDIT"]),
                                              Delete = Convert.ToBoolean(row["SCREENDELETE"].ToString()),
                                              View = Convert.ToBoolean(row["SCREENVIEW"].ToString())
                                          }).ToList();



            }

        }
        catch (Exception ex)
        {

        }
        return lstScreenAccessDetails;
    }

0 个答案:

没有答案