ho aggiornato a Meteor 1.0, installato l'ultimo pacchetto di ferro-router, hanno cercato di correre la mia app e ottenuto questo bel avvertimento nel mio log della console:totalmente confuso circa this.next() in Meteor ferro-router
Spedizione rotta mai visualizzata. Hai dimenticato di chiamare this.next() in un onBeforeAction?
Così ho provato a modificare i miei percorsi in base alla nuova versione.
this.route('gamePage', {
path: '/game/:slug/',
onBeforeAction: [function() {
this.subscribe('singlePlayer', this.params.slug).wait();
var singlePlayer = this.data();
if (singlePlayer) {
if (singlePlayer.upgrade) {
this.subscribe('upgrades', this.params.slug).wait();
this.next();
}
this.next();
}
this.next();
}],
data: function() {
return Games.findOne({slug: this.params.slug});
},
waitOn: function() { return [Meteor.subscribe('singleGame', this.params.slug)]}
});
Come posso risolvere questo? Qualsiasi aiuto sarebbe molto apprezzato.
Grazie! Che funzioni! Ho bisogno di 3 x 'this.next()' o solo una volta alla fine della funzione? – user3475602
Potrebbe non essere necessario per il primo 'if'. Fare un tentativo e riferire. – benstr
Questo ha funzionato per me: 'if (singlePlayer) { if (singlePlayer.upgrade) { this.subscribe ('upgrades', this.params.slug) .wait(); } } this.next(); ' Potresti spiegare dove dovrei posizionare' this.next() 'in generale? Il metodo Trial-and-error è un po 'frustrante. – user3475602