我将订阅放入其中:
Template.home.onCreated(function (){
this.subscribe( 'preferences', function() {
$( ".loader" ).delay( 1000 ).fadeOut( 'slow', function() {
$( ".loading-wrapper" ).fadeIn( 'slow' );
});
});
我扭曲助手打进电话:
{{#if Template.subscriptionsReady}} {{/if}}
导致异常的我的助手之一:
Template.preferences.helpers({
payWeekly: function () {
return findPreferences().payWeekly;
},
这是帮助器中使用的功能:
export const findPreferences = function() {
var currentUser = Meteor.users.findOne({_id:Meteor.userId()});
var preferences = preferencesCollection.find({companyId:currentUser.companyId});
var preferencesInstance = preferences.fetch()[0];
return preferencesInstance;
但是我仍然在控制台中看到一些异常,即在subscriptionsReady准备就绪之前调用了助手。
我得到的例外之一:
Exception in template helper: showConfirmationPanel@http://localhost:3000/app/app.js?hash=753c258a548b86565f5083306a240b5c9d728c22:12007:12
bindDataContext/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3051:14
Blaze._wrapCatchingExceptions/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:14
wrapHelper/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3103:14
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
wrapHelper/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3102:12
Spacebars.call@http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:12
template.home.js/Template.home</</<@http://localhost:3000/app/app.js?hash=753c258a548b86565f5083306a240b5c9d728c22:8771:14
Blaze.If/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2734:44
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339:5
Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:229:5
Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:613:11
Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1944:14
Blaze.If/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2733:5
fireCallbacks@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2014:19
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:640:12
Blaze._fireCallbacks/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2011:5
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
Blaze._fireCallbacks@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2010:3
Blaze._createView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2028:3
Blaze._materializeView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2073:3
materializeDOMInner@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1532:9
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1474:3
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1483:7
doMaterialize@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2092:32
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:640:12
doRender@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2090:9
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339:5
Tracker.Computation.prototype._recompute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:358:9
Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:532:9
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=6d285d84547b3dad9717a7c89c664b61b45ea3d8:398:23
任何想法为什么会发生这种情况?