【发布时间】:2013-05-20 08:10:39
【问题描述】:
我开始与 Meteor 合作,我正在处理我的第一个问题。我正在尝试在我的收藏中插入一个项目。我收到以下控制台日志错误。有人可以帮助流星菜鸟吗?
插入失败:找不到方法
这是导致错误的行:
Videos.insert({name: el.value});
我的js文件:
var Videos = new Meteor.Collection("videos");
if (Meteor.isClient) {
Template.videoList.video = function() {
return Videos.find();
}
Template.videoForm.events({
'click button': function(e, t){
var el = t.find("#name");
Videos.insert({name: el.value});
el.value = "";
}
});
}
【问题讨论】:
-
您是否也可以在服务器端访问
var Videos = new Meteor.Collection("videos")? -
是的,就是这样。我的收藏只在客户端。谢谢!
-
@Tarang 你应该发表你的评论作为答案,这样零就可以接受它。