lifegadget / ui-slider

A visually attractive slider for ambitious Ember apps
https://ui-slider.firebaseapp.com/
MIT License
30 stars 39 forks source link

immediateResponse observer not triggered #5

Closed janmisek closed 9 years ago

janmisek commented 9 years ago

Nice addon thanks.

But immediateResponse does not work because observer is not triggered during definition of component. Ember observers are not by default triggered during object init.

This currently does not work

# template.hbs
            {{ui-slider
            ticksSnapBounds=50
            tooltip='show'
            tooltipPosition='bottom'
            value=zoom
            min=zoomMin
            max=zoomMax
            immediateResponse=true
            }}

However this simple workaround works

# template.hbs
            {{ui-slider
            ticksSnapBounds=50
            tooltip='show'
            tooltipPosition='bottom'
            value=zoom
            min=zoomMin
            max=zoomMax
            immediateResponse=immediateResponse
            }}
# component.js

        didInsertElement: function() {
            Ember.run.later(function() {
                this.set('immediateResponse', true);
            }.bind(this));
        },
yankeeinlondon commented 9 years ago

Strange. It works fine on the demo app. Out of interest what version of Ember are you using?

yankeeinlondon commented 9 years ago

I'm away from my computer until tomorrow, I'll probably have a quick look at this then if you're still experiencing this.

yankeeinlondon commented 9 years ago

Actually just looked at the code on my phone ... It's a one line change. I'll make the change tomorrow as I don't believe in "phone coding". :)

yankeeinlondon commented 9 years ago

this should now be fixed (v.0.1.3); please re-open it if it is not

janmisek commented 9 years ago

Hello @ksnyde I will check soon. Thanks for quick response.

Regards Jan