Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将值传递给模式的最佳方式是什么?_Javascript_Angularjs - Fatal编程技术网

Javascript 将值传递给模式的最佳方式是什么?

Javascript 将值传递给模式的最佳方式是什么?,javascript,angularjs,Javascript,Angularjs,我正在使用,无法理解如何将值传递给模态 //钮扣 此按钮位于ng repeat=“item in vm.items”的内部,需要item以某种方式传递给模式 <button class="btn btn-danger pull-right" ui-turn-on="modal">Remove</button> 删除 //模态 &时代; 你确定吗? 是否确实要删除此项目 取消 去除 您可以使用值编写html标记(项)属性并读取该值 var id=项.属性['data

我正在使用,无法理解如何将值传递给模态

//钮扣

此按钮位于
ng repeat=“item in vm.items”
的内部,需要
item
以某种方式传递给模式

<button class="btn btn-danger pull-right" ui-turn-on="modal">Remove</button>
删除
//模态


&时代;
你确定吗?
是否确实要删除此项目

取消 去除
您可以使用值编写html标记(项)属性并读取该值

var id=项.属性['data-id'].值

单击按钮时,还可以调用如下函数
 on button click, you also call a function like

 <button class="btn btn-danger pull-right" ui-turn-on="modal" 
 ng-click="setItemID(item.itemID)">Remove</button> 

 And then create the setItemID(itemID) function into the angularjs controller
 and put the itemID into a scope variable.

 When user will click on the remove button, the setItemID function will be
 called and the itemId will be assigned into the scope. Now at the time when
 user click "Yes i want to remove this item", then use that defined itemID.
 Hope you get your solution. If still have any problem then lets comment. 
去除 然后在angularjs控制器中创建setItemID(itemID)函数 并将itemID放入范围变量中。 当用户单击删除按钮时,setItemID函数将被删除 调用并将itemId分配到范围中。现在当 用户单击“是,我想删除此项目”,然后使用定义的itemID。 希望你得到你的解决方案。如果仍然有任何问题,那么让我们发表评论。
如果你发布一些你所拥有的东西,可能会有所帮助。你是如何打开模式的?@PSL,
ui-on=“modal”
在按钮中。米卡菲有个好主意。单击按钮时,我可以在$scope上设置一个变量。思想?
 on button click, you also call a function like

 <button class="btn btn-danger pull-right" ui-turn-on="modal" 
 ng-click="setItemID(item.itemID)">Remove</button> 

 And then create the setItemID(itemID) function into the angularjs controller
 and put the itemID into a scope variable.

 When user will click on the remove button, the setItemID function will be
 called and the itemId will be assigned into the scope. Now at the time when
 user click "Yes i want to remove this item", then use that defined itemID.
 Hope you get your solution. If still have any problem then lets comment.