1b - Brief Introduction To Angular
In this section we will use angular services and review observables with RxJS
1. Add a user service
ng g service services/user/user2. Add HttpClientModule to AppModule
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { HttpClientModule } from '@angular/common/http'; // Added
@NgModule({
declarations: [
AppComponent,
HomeComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule // Added
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
3. Make a User service
4. Add a UserList component and inject in the User service
5. Use Angular ngFor to bind users
6. Add strong typing
Extra reading
Last updated