Reputation: 505
Hi i am using emberJS for binding attributes to the elements can be done by using bind-attr , the same i want to do for action to user interaction.
<button {{#if DS.session.canEditTrailers}} {{action "addTTU"}} {{/if}}
{{bind-attr class="DS.session.canEditTrailers:ttuName:readOnlyTTUName"
disabled="DS.session.canEditTrailers::disabled"}}>
Here in above i used if condition for binding action to the element button. It is not working..Can any please tell me is there any solution similar like bind-attr for actions.
Upvotes: 0
Views: 34
Reputation: 860
There is no way to do what you want in the template. You have to handle this in your action handler itself. So instead of writing {{#if DS.session.canEditTrailers}}
in the template, you should write:
// Your controller (or where you handle the action):
actions: {
addTTU: function() {
if(DS.session.canEditTrailers) {
// your code
}
}
}
Upvotes: 1