Ember, . " " . , , {{action}}, . :
<script type="text/x-handlebars" >
<button class="btn btn-info" {{action showInfo}}>Info</button>
</script>
, showInfo, Controller, , :
App.ApplicationController = Em.ArrayController.extend({
showInfo: function() {
toastr.info('This is some sample information');
}
});
; click, , , :
App.OtherView = Em.View.extend({
click: function(e) {
toastr.error('This is some sample error');
}
});
Handlebars , , click , :
{{#view App.OtherView class="btn btn-danger"}}
Error
{{/view}}
JSFiddle: http://jsfiddle.net/schawaska/YZwDh/
Ember {{action}}