1
votes

I have problem during use of checkbox in ember. I have used one boolean property for checked binding. Now i want to fire a event on change of this property or click on checkbox, but when i clicks it doesn't fires any of the event. Even it doesn't calls observer function on change of that property. below is the my code snippet,

in View- observer on "setAsRecurringAction" checked property or this can be a click event handler.

setActionSchedule: function() {
    if (this.get('setAsRecurringAction')) {
        $(".response-container").css({height: '38em'});
    } else {
        $(".response-container").css({height: '19em'});
    }
}.observes('setAsRecurringAction')

template-

{{view Ember.Checkbox 
     checkedBinding="setAsRecurringAction"
     class="set-recurring"}}

and same code with action helper also didn't work,

{{view Ember.Checkbox 
    checkedBinding="setAsRecurringAction"
    class="set-recurring"
    action="setActionSchedule"}}
  • Some more info when i checks the checkbox throws error like "Uncaught TypeError: Cannot call method 'find' of undefined"

thnx in advance.

1

1 Answers

7
votes

Take a look to the jsfiddle i just created.

If setActionSchedule is defined in a view then your have to change your checkedBinding path.

{{view Ember.Checkbox 
    checkedBinding="view.setAsRecurringAction" }}