With Meteor, I want new items added to the list to disappear. However, I do not want each item in the list to slowly disappear when something was added, only a new item was added.
I have the following collection published by the server and signed on the client
List = new Meteor.Collection("List"); Meteor.autosubscribe(function () { Meteor.subscribe('list'); });
I have the following template:
<template name="list"> {{#each list}} {{> list_item }} {{/each}} </template> <template name"list_item"> {{ text }} </template>
I would like to call the following when a new item is inserted into the collection:
function (item) { var sel = '#' + item._id; Meteor.defer(function () { $(sel).fadeIn(); }); }
I tried using
List.find().observe({ added: function (list_item) { var sel = '#' + list_item._id; Meteor.defer(function() { $(sel).fadeIn(); }); } });
However, the function is called for each item in the list when a new list_item is added, and not just for one new item.
Josh petitt
source share