Reputation: 611
I have a list of objects called categories, within them is an array of other objects which are the posts within that category, where id :129 is the category id and ID :100 is the posts id. it looks like this
In my html i have a button on each category item, that when clicked, it takes that category and its contents, (posts and other data) and inserts it into a new collection that is supposed to be specific to the user, like a bookmark. i.e how tumblar, flipboard, google currents, zite have streams personal to the user, and when you follow a topic, the posts in that topic reflect on your personal stream.
However i'm getting two errors
on the chrome console i get:
in my terminal i get:
my server js is like this
Meteor.methods({
'addTimeline': function(data){
Timeline.insert(doc);
}
});
My client js looks like this
Timeline.allow({
insert: function (userId) {
return (userId);
}
});
Template.CategoriesMain.events({
'click .addFav': function() {
Meteor.call('addTimeline');
}
});
My html looks like this
<template name="CategoriesMain">
<ul>
{{#each articles}}
<li>
<a href="/catsingle/CategorySingle/{{_id}}"><h2>{{name}}</h2></a>
</li>
<button type="checked" name="button" class="addFav">add to fav</button>
{{/each}}
truth is i'm quite new to meteor so i have been trying to hack and sash so i'm not sure what the problem is exactly or how to make it work.
Upvotes: 0
Views: 229
Reputation: 8345
I can see two errors.
Error 1
In your method addTimeline
, you use the variable doc
, but you name your parameter data
.
Error 2
In your click event handler, you call the method addTimeline
, but you don't pass it any argument (the data
parameter will be undefined
.
Upvotes: 1