【发布时间】:2014-04-16 12:00:35
【问题描述】:
我正在为我的页面使用 ember.js 和 bootstrap。
我的模态中有两个按钮,需要根据按钮的值执行两个不同的操作,例如批准操作和拒绝操作
<button type="button" class="btn btn-default" value="decline" {{action "pendingAction" selectedRow target="controller" }}>Decline</button>
<button type="button" class="btn btn-primary" value="approve" {{action "pendingAction" selectedRow target="controller"}}>Approve</button>
现在我想获取用户在控制器中单击的按钮的值
App.ApprovalrequestsController = Ember.ObjectController.extend({
actions:{
pendingAction:function(){
//get the clicked button value here, so that i can do different tasks
based on the value of button
}
}
});
现在我想在控制器中的操作中获取单击按钮的值,以便我可以执行不同的任务.. 任何人都可以帮助我是新手。
【问题讨论】:
-
您可以将参数从操作传递给函数 - 这是您的意思吗?见emberjs.com/api/classes/…
标签: twitter-bootstrap ember.js