我使用emberjs提交或按钮时使用操作。
在emberjs中查看使用操作
这是模板
<script type="text/x-handlebars" id="login">
<form class="form-horizontal" id="loginForm" >
{{view App.Views.TextField id="username"}}
{{view App.Views.TextField id="password"}}
<input type="submit" value="Login" {{action login this}} />
</form>
</script>
这是view.js
App.Views.login = Ember.View.create({
templateName: 'login',
controllerBinding: 'App.Controllers.login',
username: '',
password: '',
login: function(){
alert("this is view.js");
}
});
这是controller.js
App.Controllers.login = Ember.Object.create({
login: function(event){
alert("This is controller.js");
}
});
但我不能看到任何警告信息。我想看到这两条消息。