O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating the wrapper functions in TodoService

We have functions such as getTodos, getPendingTodos, postTodos, putTodo, and deleteTodo that interact with the GET, POST, PUT, and DELETE Web API actions respectively. Now, let's update or replace the code of the remove, add, toggleCompletion, and removeCompleted functions that serve as wrappers that will be consumed from app.component.ts. Update or replace the code of the functions, as shown in the following code snippet:

    remove(todo: Todo) {         this.deleteTodo(todo);             }     add(title: string): Promise<Todo> {         var todo = new Todo(0, title, false);         return this.postTodo(todo);     }     toggleCompletion(todo: Todo) {         todo.completed = !todo.completed;         this.putTodo(todo);     }     removeCompleted() {  this.getPendingTodos(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required