Reputation: 11
How to get button's action in way like this:
<script type="text/x-handlebars">
{{#view Ember.Button target="Welcome.booksController" action="loadBooks" id="butt_logger"}}
Load Books
{{/view}}
</script>
in js file
$(document).ready( function () {
$('button#butt_logger').click(function(){
console.log("Button was Clicked");
});
});
or
Welcome.booksController = Ember.ArrayController.create({
content: [],
loadBooks: function(){
console.log("Button was Clicked");
//any script
}
});
Both of them doesn't work(( I need advice. Thanks.
Upvotes: 1
Views: 812
Reputation: 12011
As you can see in Ember.Button source code:
Ember.deprecate("Ember.Button is deprecated and will be removed from future releases.
Consider using the {{action}} helper.");
Using the {{action}} helper, your template will look like:
<script type="text/x-handlebars">
<button {{action loadBooks target="Welcome.booksController" }} id="butt_logger">Load books</button>
</script>
Upvotes: 1