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 AppComponent

We have the updated todo.service.ts that interacts with the Web API and is ready for us to consume in app.component.ts. The updated code snippet of app.component.ts is as shown:

import { Component, OnInit } from '@angular/core'; import { Todo } from './todo' import { TodoService } from './todo.service' @Component({     selector: 'my-app',     templateUrl: './app/app.component.html',     providers: [TodoService] }) export class AppComponent implements OnInit {     todos: Array<Todo>;     newTodoText = '';     constructor(private todoService: TodoService) {         this.todos = new Array();     }     getTodos(): void {         this.todoService             .getTodos()             .then(todos => this.todos = todos);     }     ngOnInit(): void {         this.getTodos();     }  removeCompleted() ...

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