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 AppComponent class

Now that we have the TodoService class in place, let's update the AppComponent class, as shown, to consume the TodoService class:

import { Component } from '@angular/core';   import { Todo } from './todo'   import { TodoService } from './todo.service'     @Component({       selector: 'my-app',       templateUrl: './app/app.component.html'   })   export class AppComponent {       todos: Array<Todo>;       todoService: TodoService;       newTodoText = '';       constructor(todoService:   TodoService) {           this.todoService =   todoService;           this.todos =   todoService.todos;       }       removeCompleted() {           this.todoService.removeCompleted();       }       toggleCompletion(todo: Todo)   {             this.todoService.toggleCompletion(todo);       }       remove(todo: Todo) {    this.todoService.remove(todo); ...

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