Meteor.call() 在聚合物元素内导致错误
Meteor.call() inside a polymer-element causes error
目前我正在使用 Polymer 0.5 的 MeteorJS,当我在聚合物元素中写入 Meteor.call()(用于向服务器发送数据的 MeteorJS 函数)时会导致错误 Uncaught SyntaxError: Unexpected token <
我的密码是
signUpTap: function(event, detail, sender) {
var _this = this;
Meteor.call("signUp", function(_this.signUp, response) {
_this.toastOpened = false;
if (error) {
window.setTimeout(function() {
_this.toastText = error.reason;
_this.toastOpened = true;
}, 400);
} else {
window.setTimeout(function() {
_this.toastText = response;
_this.toastOpened = true;
}, 400);
}
});
}
我认为这是由于 Meteor.call() 和 polymer call() 函数之间的冲突,我如何避免这种情况?
Meteor.call()
调用服务器端方法。第一个参数是方法名称(在本例中为 "signUp")。您似乎有一些参数应该作为方法调用的一部分作为回调函数中的参数。
http://docs.meteor.com/#/full/meteor_call
我想你想要 Meteor.call("signUp", _this.signUp, function(error, response)
目前我正在使用 Polymer 0.5 的 MeteorJS,当我在聚合物元素中写入 Meteor.call()(用于向服务器发送数据的 MeteorJS 函数)时会导致错误 Uncaught SyntaxError: Unexpected token <
我的密码是
signUpTap: function(event, detail, sender) {
var _this = this;
Meteor.call("signUp", function(_this.signUp, response) {
_this.toastOpened = false;
if (error) {
window.setTimeout(function() {
_this.toastText = error.reason;
_this.toastOpened = true;
}, 400);
} else {
window.setTimeout(function() {
_this.toastText = response;
_this.toastOpened = true;
}, 400);
}
});
}
我认为这是由于 Meteor.call() 和 polymer call() 函数之间的冲突,我如何避免这种情况?
Meteor.call()
调用服务器端方法。第一个参数是方法名称(在本例中为 "signUp")。您似乎有一些参数应该作为方法调用的一部分作为回调函数中的参数。
http://docs.meteor.com/#/full/meteor_call
我想你想要 Meteor.call("signUp", _this.signUp, function(error, response)