Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Maja B.
Maja B.
12,984 Points

AngularJS - A Simple Todo List

Hi, I'm building a very simple Todo List with Angular and Bootstrap. You can have a look at it at Codepen

The problem is that when I do the following with Task 2:

  1. Click the Edit button of Task 2, make some textual changes and Save them.
  2. Check the checkbox of Task 2 (like saying task completed; Task 2 gets a line through)
  3. Click Remove button of Task 2

Well in this case the last task is deleted instead of Task 2.

Anyone knows why? What should I fix ...

3 Answers

Jon Brady
Jon Brady
10,868 Points

works fine this end

Maja B.
Maja B.
12,984 Points

Are you sure? If you edit task (it should be task 1 or task 2, not the last one), save it, mark it as complete (by checking its checkbox) and remove it ... this works fine?

Well on my side it deletes the last task not the one that I'm working on.

Could you please check it again?

Jon Brady
Jon Brady
10,868 Points

i take that back ... humm

Anthony Kornmeier
Anthony Kornmeier
8,278 Points

It appears that you are not saving the changes from your 'edit' and 'completed' forms to your tasks array in the scope. That is throwing off the state of the other tasks.