import { Component , OnInit , ViewEncapsulation } from '@angular/core' ; import { ActivatedRoute } from '@angular/router' ; import { HelpModel , HelpTopic } from '@shared/models/index.model' ; @ Component ( { selector : 'dashboard-help-detail' , templateUrl : './help-detail.component.html' , styleUrls : [ './help-detail.component.scss' ] , encapsulation : ViewEncapsulation . None , } ) export class HelpDetailComponent implements OnInit { public data : HelpModel = new HelpModel ( ) ; param route constructor ( private route ) { } /**
     * Life cycle init method
     * Find the topics based upon the help path and display it in help detail component
     */ ngOnInit ( ) { this . route . data . subscribe ( ( data ) => this . data . content = data [ 0 ] ) ; const path = this . route . snapshot . paramMap . get ( 'path' ) ; const topics = this . data . topics ; const filteredTopic = topics . find ( ( topic ) => topic . path === path ) ; this . data . icon = filteredTopic . icon ; this . data . title = filteredTopic . title ; } }