import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Route } from '@angular/router';
import { LoginComponent } from './containers/login/login.component';
import { LoginFormComponent } from './components/login-form/login-form.component';
import { HttpClientModule } from '@angular/common/http';
import { MaterialModule } from '@demo-app/material';
import { ReactiveFormsModule } from '@angular/forms'; // Added
export const authRoutes: Route[] = [
{ path: 'login', component: LoginComponent }
];
@NgModule({
imports: [
CommonModule,
RouterModule,
HttpClientModule,
MaterialModule,
ReactiveFormsModule // added
],
declarations: [LoginComponent, LoginFormComponent]
})
export class AuthModule {}
2. Add a Reactive FormGroup to Login Form
Note: To save injecting the formBuilder and keeping this a presentational component with no injected dependancies we can just new up a simple FormGroup. You can read more about it here https://angular.io/api/forms/FormBuilder.