Add book dialog

In this section, you are going to learn how to implement a form using Angular Material form controls and a dialog using MdDialog:

The code for src/app/books/add-book-dialog/add-book-dialog.component.ts is as follows:

import { Component } from '@angular/core'; import { MdDialogRef } from '@angular/material'; @Component({   selector: 'add-book-dialog',   styleUrls: ['./add-book-dialog.component.scss'],   templateUrl: './add-book-dialog.component.html' }) export class AddBookDialogComponent  {   constructor(private dialogRef:              MdDialogRef<AddBookDialogComponent>) {} } 

In the preceding component, we are injecting the MdDialogRef into the constructor, which can be used to refer to the dialog itself.

The code for src/app/books/add-book-dialog/add-book-dialog.component.html ...

Get Building Modern Web Applications using Angular now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.