在Ember.Select中绑定操作 [英] Binding Action in Ember.Select
本文介绍了在Ember.Select中绑定操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在Ember.Selectsó中绑定一个动作,当用户更改类别时,我可以执行其他操作:
{{查看Ember.Select class =form-controlid =PackCategory
content = Categories
optionValuePath =content.categoryId
optionLabelPath =content.name
value = VendingAdminController.selectedPack.categoryId}}
以及如何将视图指定为目标?
谢谢
解决方案
/ p>
只需在控制器中创建一个观察 {{select}}的价值属性的函数
onSelectedPackChange:function(){
//插入需要排除的代码在这里更改
} .observes ('selectedPack.categoryId')
上面的代码应该放在你的 VendingAdm inController
。
I was wondering how to bind an action in an Ember.Select só when the user change the category i could perform other operations:
{{view Ember.Select class="form-control" id="PackCategory"
content=Categories
optionValuePath="content.categoryId"
optionLabelPath="content.name"
value=VendingAdminController.selectedPack.categoryId}}
and also how to specify the view as the target?
Thank you
解决方案
Like kingpin suggested,
Just create a function in your controller that observes the value property of the {{select}}
onSelectedPackChange:function(){
//insert the code that needs to be excuted on change here
}.observes('selectedPack.categoryId')
The above code should be placed in your VendingAdminController
.
这篇关于在Ember.Select中绑定操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文