Lazov
Lazov

Reputation: 1476

Meteor iron:router transitions

I am trying to implement transitions between pages by using iron:router. I defined the animations in the css and now everything I need is to call them with the iron:router. For some reason the following code:

animateContentOut = function() {
    $('#content').removeClass("animated fadeIn");
    return $('footer').addClass("hide");
}

fadeContentIn = function() {
    $('#content').addClass("animated fadeIn");
    return $('footer').removeClass("hide");
}

Router.onBeforeAction(animateContentOut);
Router.onAfterAction(fadeContentIn);

returns an exception:

Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?

Upvotes: 1

Views: 87

Answers (2)

sravanthi
sravanthi

Reputation: 247

If you have login try like this

Router.onBeforeAction(function () {
    if (!Meteor.user()) {
      this.render('Login');
    } else { 
      this.next();
     }
});

Upvotes: 0

forallepsilon
forallepsilon

Reputation: 429

As specified in the Iron-Router documentation, now both onBeforeAction and onAfterAction callbacks require this.next(). https://github.com/iron-meteor/iron-router

So simply simply add that line to the end of your fadeContentIn and animateContentOut code.

Upvotes: 1

Related Questions