聚合物元素内部的Meteor.call()会导致错误



当前我正在使用聚合物0.5的MeteorJS,当我在聚合物元素内写入Meteor.call()(用于向服务器发送数据的Meteor.JS函数)时,会导致错误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) 这样的东西

相关内容

最新更新