angular-crash-todolist icon indicating copy to clipboard operation
angular-crash-todolist copied to clipboard

deleting one new todo -> deletes all new todos

Open gonenshafry opened this issue 5 years ago • 2 comments

Form submit doesn't generate todo.id, resulting in delete one new todo -> deletes all new todos. Can you please update the code?

gonenshafry avatar Jul 30 '19 11:07 gonenshafry

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<Todo> { const url = ${this.todosUrl}/${todo.id}; return this.http.delete<Todo>(url, httpOptions); }

https://jsonplaceholder.typicode.com/guide.html

jwhy89 avatar Nov 22 '19 09:11 jwhy89

This helps, thank you.

cognitive137 avatar Mar 26 '20 14:03 cognitive137