Tutorial "temporary UI state" Error


#1

I’m trying the tutorial, but I can’t get past the step 8, “temporary UI state.” It says “simple-todos.js:25:3: Unexpected string.” I don’t understand it because I followed the tutorial step by step. This is my code:

Tasks = new Mongo.Collection("tasks");


if (Meteor.isClient) {
 // This code only runs on the client
 Template.body.helpers({
  tasks: function() {
    if(Session.get("hideCompleted")) {
      return Tasks.find({checked: {$ne: true}}, {sort: {createdAt: -1}});
    } else {
      return Tasks.find({}, {sort: {createdAt: -1}});
    }
  },
  hideCompleted: function () {
    return Session.get("hideCompleted");
  }
 })

 Template.body.events({
  
  "change .hide-completed input": function (event) {
    Session.set("hideCompleted", event.target.checked);
  }

  "submit .new-task": function (event) {
    //This function is called when the new task form is submitted

    var text = event.target.text.value;

    Tasks.insert({
      text: text,
      createdAt: new Date() // current time
    });
    // Clear form 
    event.target.text.value = "";

    // Prevent default form submit
    return false;
  }
 });

 Template.task.events({
  "click .toggle-checked": function () {
    //Set the checked property to the opposite of its current value
    Tasks.update(this._id, {$set: {checked: ! this.checked}});
  },
  "click .delete": function () {
    Tasks.remove(this. _id);
  }
 });

}

#2

you are missing “,” on line 23 after “}” I think :smiley:


#3

Didn’t know it was necessary… Thank you!