简体   繁体   中英

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?

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.

If you have login try like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM