javascript - Not found page pops up for a second - Meteor - iron - router -
I upgraded my app to meteorite 1.0 and updated my router.js
because I do not use .wait ()
However, now my unpiled page is popped up for just a second before the 'real page' appears before. How can I fix this?
This is my code:
this.route ('gamePage', {path: '/ game /: slug /', onBeforeAction: [function () Subscriber ('singleplayer', this.param.Sol); var single player = DATA (); if (single player) {if (singlepillier upgrade) {this.subscribe ('upgrade', this .params.slug);}} This.next ();}], data: function () {return games.Fundon ({slug: this.params.slug}}}, waiton: function (return) [Return meteor ('single game', ' This.params.slug)]}});
Any help would be greatly appreciated.
its Instead of subscriptions
patterns.
this.route ('gamePage', {path: '/ game /: slug /', subscription: function ()} return meteor membership Take ('singleplayer', this.parms. Slug);}, on-backaction: function () {var single player = it's a dot (); if (singleplayer) {if (singleplayer upgrade) {this.subscribe ('upgrade 'This.params.slug);}} this.next ();}, data: function () {return games.Fundon ({slug: this.params.slug}}}, wait: function () {return [Subscribe to meteor ('single game', this.params.slug)]}});
However, it is important that you can also include the loadingTemplate
plugin to avail the loading
plugin.
Router Configure ({loadingTemplate: 'loading' // general purpose loading template}); // built in the plugin .. is surprisingly not specified in the current docs, but you can dive into the code for the plug-in. // https://github.com/EventedMind/iron-router/blob/devel/lib/plugins.js Router.On action action ('load', {only: ['gamepage']}); // loading router for pages with only membership.map (function () {this.route ('gamePage', {// ... your other options are here .. loadingSupport: 'gameplayloading' , // game page dedicated loading markup.});});
If you want to be in your onBeforeAction
implementation then there is also this.ready ()
pattern.
this.route ('gamepages', {path: '/ game /: slog /', on-back action: [function () (this symbian ('single player', this. Slug;; if (this.ready ()) {var singlePlayer = this.data (); if (singleplayer) {if (singlePlayer.upgrade) {this subscribe ('upgrade', this.params.slug);}} This.next ();} and {it. Render ('load');}}}, data: function () {back games.findon ({slug: this.params.slug})}}, wait: function () {Return to Meteor ('single game', this.params.slug)}}};
Source:
I think it Change was necessary because .vt
pat It was seen as an unnecessary chaining and it was coding errors. Additionally, when handling .next ()
onBeforeAction
now this hook ( And possibly most, if not all other hooks).
Comments
Post a Comment