Todo app tutorial and deleting Todo's

Hi everyone,

I am currently in the process of learning meteor. I have encountered a problem however and i can’t seem to be able to sort it out. I apologize if this is a stupid question.

I am following the todo app tutorial but my todo app is differing a bit from the one in the tutorial and that’s why i am having this problem.

In the tutorial the app has a button to delete each task on the task themselves. I wanted to have one delete button wich will delete all checked tasks. What i am trying to do is after clicking delete button the app would find and delete all tasks with the field “checked: true” in them.

Any advice how i could go on doing this?

Well, first you add checkboxes to your each loop, then you add delete all button, then you write an event an it’s done.

Please paste a full code of the way you’ve tried to achieve it. Because you tried to do it first by yourself before asking, right?

This way we’ll be able to guide you further.

if you understand how to set up a botton-click event, you could have that do a remove on your collection, with a selector pointing at checked:true.

if you have the autopublish package, you can do it directly in the button-click event. Otherwise you’d have the button do a ‘’ on a method you have specified in isomorphic code (both client and server) and have that method perform the action on both sides at once :smile: this adds the nice side-effect of latency compensation…

1 Like