deleting one new todo -> deletes all new todos
Opened this issue · 2 comments
gonenshafry commented
Form submit doesn't generate todo.id, resulting in delete one new todo -> deletes all new todos. Can you please update the code?
jwhy89 commented
Form submit doesn't generate todo.id, resulting in delete one new todo -> deletes all new todos. Can you please update the code?
The id property will always be 201. This is just a test API and so in the real world, the database would auto-increment the value of the id. The deleteTodo function in the todo.service.ts targets the id property only.
deleteTodo(todo: Todo): Observable {
const url = ${this.todosUrl}/${todo.id}
;
return this.http.delete(url, httpOptions);
}
cognitive137 commented
This helps, thank you.