【发布时间】:2015-01-04 01:11:25
【问题描述】:
#Meteor v. 1.0# Meteor.call(title, description) 抛出异常
检查客户端的参数:
'click div[name="saveCollection"]' : function(e) {
var title = 'Title'
var description = 'Description'
check(title, String)
check(description, String)
Match.test(title, String) --> It's true
Match.test(description, String) --> It's also true
Meteor.call('saveCollection', title, description, function(error, result){
...
})
}
检查服务器上的参数:
saveCollection: function (title, description) {
check(title, String)
check(description, String)
Match.test(title, String) --> It's true
Match.test(description, String) --> It's also true
Collection.insert({
title: title,
description: description
})
}
调用方法“saveCollection”时出现异常错误:在调用“saveCollection”期间未检查()所有参数
我做错了什么??
【问题讨论】:
-
@Kyll,检查客户端的参数(两次)既不正常也没有必要。
-
@j03I 这是代码库中唯一调用
saveCollection的实例吗? -
也许有一种变通方法会奏效。在服务器代码上,不是用
title和description调用check(),你能不能分别用arguments[0]和arguments[1]替换它们? -
我已经替换了参数,但问题仍然存在。我会继续努力:)
标签: meteor