mardi 13 octobre 2015

A property in an ember component is not propagating to its parent controller

I have a component priority-selector that looks like this...

export default Ember.Component.extend({
    priority: 'low',
    didInsertElement: function() {
         this.$('[data-toggle="tooltip"]').tooltip();
    },
    actions: {
        click: function(priority) {
            this.set('priority', priority);
            this.$('.btn-primary').removeClass('btn-primary');
            this.$('.btn-for-' + priority).addClass('btn-primary');
        }
    }
});

I use this component in a template like so...

<div class='col-sm-3'>
    {{priority-selector priority=priority_gender}}
</div>

And I have it specified in the controller...

export default Ember.Controller.extend({
    ...
    priority_gender: 'low'
    ...
})

But the property in the controller never changes when I interact with the component, I can observe this to be the case by looking in the ember inspector.




Aucun commentaire:

Enregistrer un commentaire