javascript - 如何使用 AngularJS 将一个人从 DropDownList (ddl 位于表 1 )移动到另一个表(表 2)?

标签 javascript html angularjs

这是我的第一篇文章,所以请善待我。 :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/

相关文章:

javascript - 如何在提交前对 html 元素进行 jQuery 表单验证

javascript - 在javascript中过滤对象数组

Javascript 文本输入更改处理程序与 div 单击处理程序相结合

javascript - 为什么这个简单的 Javascript 重构不起作用?

javascript - 在asp.net中从客户端浏览器向服务器发送文件有哪些方法?

angularjs - Angularfire:如何等待 firebase 加载?

javascript - 通过发送 input.xml 并从 external.js 文件获取 output.xml,从 HTML 页面执行外部 .js 文件

html - 下拉菜单在 ebay 上不起作用

angularjs - CSP 2.0(不安全内联)和 Angular

angularjs - Cordova s​​qliteplugin karma 测试说明