【发布时间】:2017-01-22 17:02:13
【问题描述】:
如何在meteor.js 等待网络服务调用时显示进度加载器?在等待来自 mongo 集合的数据时,我一直在使用 Iron 路由器来显示进度,但现在我面临的数据来源略有不同。因此,如果您有这个想法,请随时给我一个铁路由器解决方案。欢迎任何想法。 如果您对我的代码感兴趣,如下所示:
if (Meteor.isClient) {
Template.confirmWeather.onRendered(function(){
var validator = $('.confirmWeatherAndGoToMessage').validate({
submitHandler: function(event){
Meteor.bindEnvironment(Meteor.call('testWeather',Meteor.bindEnvironment(function(error,result)
{
if (error)
{
console.log(error.message)
}
else
{
var userId = Meteor.userId();
var user = Meteor.users.findOne({_id: userId});
if (user.testData)
{
Router.go('showFocust');
}
else
{
Router.go('showError');
}
}
})));
}
});
});
}
请注意,方法调用可以移动到 showFocust 模板。所以没有什么是一成不变的。哦,如果你有一个类似的例子,你以前解决过,请随时解释你是如何解决的。谢谢
【问题讨论】:
标签: javascript meteor iron-router