Angular Material login page using reactive forms with validation

<h4>Login Page Example with Angular Material </h4>
<form [formGroup]="loginForm" (ngSubmit)="onSubmit()" novalidate>
  <div class="example-container">
    <mat-form-field>
      <input matInput placeholder="Email" formControlName="email">
    </mat-form-field>

    <mat-form-field>
      <input matInput type="password" placeholder="Password" formControlName="password">    
    </mat-form-field>

    <button [disabled]="!loginForm.valid" mat-raised-button color="primary" mat-button>Sign In</button>
  </div>
</form>

<pre>
{{loginForm.value | json }}
</pre>
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, FormControl, Validators, FormArray } from '@angular/forms';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  loginForm: FormGroup;
  constructor() {
    this.loginForm = new FormGroup({
      email: new FormControl('', [Validators.required, Validators.email]),
      password: new FormControl('', [Validators.required])
    });
  }
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

import {MatButtonModule} from '@angular/material';

import {MatInputModule} from '@angular/material';

@NgModule({
  imports:      [
      BrowserModule,
      FormsModule,
      BrowserAnimationsModule,
      MatButtonModule,
      MatInputModule,
      ReactiveFormsModule
    ],
  declarations: [ AppComponent, HelloComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
@import "~@angular/material/prebuilt-themes/indigo-pink.css";