mercredi 28 octobre 2015

Class Bindings dynamically with Ember.run.later

I want to add an animation after few seconds i have landed in a page

I need to bind a class to achieve it

This is my markup

{{#if isAnimate}}
    <i class="fa fa-cog fa-fw big fa-counter"></i>
{{else}}
    <i class="fa fa-cog fa-fw big"></i>
{{/if}}

So if it isAnimate the class fa-counter makes start the animation

in my controller by default isAnimate is False and i am trying to use Ember.run.later

var MenuController = Ember.ObjectController.extend({
    isAnimate: false,
    startWatchingAnimation: function(controller){
        var self = this;
        Ember.run.later(function(){
          self.set('isAnimate', true);
        }, 1000);
    },
});

how can i pass my function to the template in order to dynamically bind the class ?




Aucun commentaire:

Enregistrer un commentaire