Meteor.call() inside a polymer-element causes error

时间:2015-06-30 13:46:10

标签: javascript meteor polymer

currently i am working MeteorJS with polymer 0.5, when i write Meteor.call() (MeteorJS function used to send data to server) inside an polymer-element cause an error Uncaught SyntaxError: Unexpected token <

my code is

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);
        }
    });
}

i think it's due to clash between Meteor.call() & polymer call() functions how i avoid this ?

1 个答案:

答案 0 :(得分:0)

Meteor.call()调用服务器端方法。第一个参数是方法名称(在本例中为“signUp”)。你似乎有一些参数应该是你的回调函数中作为参数的方法调用的一部分。 http://docs.meteor.com/#/full/meteor_call

我想你想要像Meteor.call("signUp", _this.signUp, function(error, response)

这样的东西