javascript - How to get last/previous visited route with iron-router - meteor -
i went situation need last visited page iron-router in meteorjs. checked docs didn't solution there. have current() function that's gives current route name. there way it?
i need show specific data when last visited page equal set page.
i tried:
document.referer
but works when page refresh.
thanks,
i don't think can last route directly. save current route in session variable , check against that, (untested):
router.route('/route', { name: 'route', onrun: function() { if (router.current().route === session.get("lastroute")) { console.log('same route'); } }, onafteraction: function() { session.set("lastroute", router.current().route); }, });
Comments
Post a Comment