//Importing the libraries import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; //Importing the service classes import { DashboardService } from '../../shared/service/dashboard.service'; //Importing the core classes import { IOptions } from '../../shared/core/IOptions'; import { CookieService } from 'ngx-cookie-service'; @Component({ selector: 'app-contact-history', templateUrl: './contact-history.component.html', styleUrls: ['./contact-history.component.scss'] }) export class ContactHistoryComponent implements OnInit { contactDetails: any contactId: string contactOptions: IOptions; constructor( private route: ActivatedRoute, private _dashboardService: DashboardService, private cookieService: CookieService ) {} /** ngOnInit() starts*/ ngOnInit() { /** get parameter contactId */ this.route.paramMap.subscribe(params => { this.contactId = params.get("contactId") }) /** preparing parameters and options to retrieve contact list, this collection is the one accepts as the parameter in API */ this.contactOptions = { Params: [{ 'key': 'id', 'value': this.contactId }], FilterValue: [{ 'key': '', 'value': null }], SearchValue: "", RecordCount: 20, CurrentPage: 1 } /** get specific contact details by Id */ this._dashboardService.getContactList(this.contactOptions, +this.cookieService.get('CompanyId')).subscribe(res => { this.contactDetails = res; //console.log(this.contactDetails); }); } /** Ends - ngOnInit()*/ }