【发布时间】:2015-07-18 22:57:21
【问题描述】:
我尝试使用 ReactiveVar。我不知道如何处理 ReactiveVar。这是我尝试过的代码。
Template.Home.helpers({
names: function(){
temp = Template.instance().name.get();
return temp;
}
});
Template.Home.onCreated(function () {
this.name = new ReactiveVar();
Meteor.call("getNames", function(error, result) {
if(error){
alert("Oops!!! Something went wrong!");
return;
} else {
this.name.set(result); // TypeError: Cannot call method 'set' of undefined
return;
}
});
});
设置和获取 ReactiveVar 是否正确?或者如何设置和获取 ReactiveVar ??
【问题讨论】:
标签: javascript meteor meteor-autoform meteor-helper