我想知道如何绑定Ember中的动作.选择só当用户更改类别时我可以执行其他操作:
{{view Ember.Select class="form-control" id="PackCategory"
content=Categories
optionValuePath="content.categoryId"
optionLabelPath="content.name"
value=VendingAdminController.selectedPack.categoryId}}
Run Code Online (Sandbox Code Playgroud)
以及如何将视图指定为目标?
谢谢
我试图找出是否在控制器中选中了复选框.
这是我的模板:
<script type="text/x-handlebars">
{{view Ember.TextField valueBinding="firstname" placeholder="First Name"}}
<input type="checkbox" name="remember_me"> Remember me </input>
<button {{action save }}>Save</button>
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend({
save: function(){
//need to get the value of "remember_me" here
alert(this.get("firstname"));
}
});
Run Code Online (Sandbox Code Playgroud)
如何在控制器中获取"remember_me"的值(无论是否选中).我可以在复选框上执行valueBinding.如果是的话,请你给我一个示例语法.
的jsfiddle: