这是我的第一篇文章,所以请善待我。 :D 我想要的是从 DropDownList(在表 1 上)中选择一个人,当我按下按钮时,我想将选定的人移动到另一个表(在表 2 上)。 我将从我的电脑上发布一些屏幕,因为我无法添加代码(我收到一些错误,其中说代码太多或类似的东西......)
这是照片链接。我没有 10 声誉,所以我无法发布带有描述的不同 URL...:D
http://postimg.org/gallery/13lmzz4kq/
我在每张照片中都写了描述:D
提前!
最佳答案
在你的 plunker 中,你有一个方法 moveAudit
。此方法接收一个项目:
$scope.moveAudit = function (item) //Function for moving the unassigned audits
{
//var assignedAudit = $scope.assignedAudit; //--> you dont need this here
//var audit = $scope.unassignedAudit; //--> unused variable
//var auditId = $scope.unassignedAudit.IdUnassignedAudit; //--> unused variable
//TODO: here you need to add the selected 'expert' to item
// inspect/debug how your form POST passes this information to the controller
// ideally put it in a scoped var or pass it in the method: $scope.moveAudit = function (item, selectedExpert)
item.AssignedExpert = $scope.selectedExpert
//add to AssignedAudit
$scope.assignedAudit.push(item);
console.log("Row added: ", $scope.assignedAudit);
//TODO: probably you want to remove the item from $scope.assignmentExperts
};
我无法调试 plunker,因为它不完整,但这应该可以解决问题。
进一步检查您的代码后,看起来 $scope.ddSelection
是选定的专家。
关于javascript - 如何使用 AngularJS 将一个人从 DropDownList (ddl 位于表 1 )移动到另一个表(表 2)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30100594/