import { Component , OnInit , OnDestroy , HostBinding , NgModuleFactory , Type , ElementRef } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { ActivatedRoute , Router } from '@angular/router' ; import { NavigationService , GlobalContext } from '../../services/public-api' ; @ Component ( { selector : 'dg-channel' , templateUrl : './channel.component.html' } ) export class ChannelComponent implements OnInit , OnDestroy { @ HostBinding ( `class.dg-layout` ) isLayout = true ; @ HostBinding ( `class.dg-scroll-container` ) isScrollContainer = true ; /** Component type for the current example. */ exampleComponentType : Type < any > | null = null ; exampleModuleFactory : NgModuleFactory < any > | null = null ; constructor ( private http , private elementRef , private route , private router , public navigationService , public global ) { } ngOnInit ( ) { const path = this . route . snapshot . routeConfig . path ; this . navigationService . selectChannelByPath ( path ) ; } ngOnDestroy ( ) { this . navigationService . clearChannel ( ) ; } } @ Component ( { selector : 'dg-channel-home' , template : `` } ) export class ChannelHomeComponent implements OnInit { constructor ( private router , public navigationService , public global , private route ) { } ngOnInit ( ) { const firstDocItem = this . navigationService . getChannelFirstDocItem ( ) ; if ( firstDocItem ) { this . router . navigate ( [ './' + firstDocItem . path ] , { replaceUrl : true , relativeTo : this . route } ) ; } } }