import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute } from '@angular/router' ; import { ContactFeedDialogComponent } from '../contact-feed' ; import { Contact , ContactService , } from '../shared' ; import { constants } from './contact-detail.constants' ; import { MatDialog } from '@angular/material' ; @ Component ( { selector : 'app-contact-detail' , templateUrl : './contact-detail.component.html' , styleUrls : [ './contact-detail.component.css' ] } ) export class ContactDetailComponent implements OnInit { public loadingContactMessage : string = constants . LOADING_CONTACT_MESSAGE ; public noContactFoundMessage : string = constants . NO_CONTACT_FOUND_MESSAGE ; public isLoading = true ; public contact : Contact = null ; constructor ( private contactService , private route , private dialog ) { } ngOnInit ( ) { this . loadContact ( ) ; } private loadContact ( ) { this . route . params . subscribe ( params => { const id = + params [ 'id' ] ; this . contactService . getContact ( id ) . subscribe ( contact => { this . isLoading = false ; this . contact = contact ; } ) ; } ) ; } openDialog ( ) { setTimeout ( ( ) => { const dialogRef = this . dialog . open ( ContactFeedDialogComponent ) ; dialogRef . afterClosed ( ) . subscribe ( result => { } ) ; } , 500 ) ; } }