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 AppModule

We need to tell the injector that it needs to inject TodoService when AppComponent is constructed. So, to let the injector know about the TodoService class, we need to add TodoService as provider in AppModule to supply TodoService when it is required by the AppComponent. The following code snippet shows the updated app.module.ts file:

import { NgModule } from '@angular/core';   import { BrowserModule } from '@angular/platform-browser';   import { FormsModule } from '@angular/forms';   import { AppComponent } from './app.component';   import { TodoService } from './todo.service'   @NgModule({       imports: [           BrowserModule,           FormsModule       ],       declarations: [AppComponent],       providers: [TodoService],       bootstrap: [AppComponent]   })   

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