import { ChangeDetectionStrategy , Component , EventEmitter , Input , OnInit , Output } from '@angular/core' ; import { Router , Routes } from '@angular/router' ; import { Language } from '../../shared/interfaces/language-interface' ; @ Component ( { selector : 'navbar' , templateUrl : './navbar.component.html' , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class NavbarComponent implements OnInit { @ Input ( ) title : string ; @ Input ( ) set childrenRoutes ( routes ) { this . _childrenRoutes = routes . filter ( ( item ) => item . data ) ; } get childrenRoutes ( ) { return this . _childrenRoutes ? this . _childrenRoutes . filter ( ( item ) => item . data && item . data . visible !== false && item . data . align !== 'left' ) . map ( ( item ) => { const newItem = item . data ; newItem . url = `/${ newItem . name }` ; newItem . redirectTo = item . redirectTo ; return newItem ; } ) : [ ] ; } get leftChildrenRoutes ( ) { return this . _childrenRoutes ? this . _childrenRoutes . filter ( ( item ) => item . data && item . data . visible !== false && item . data . align === 'left' ) . map ( ( item ) => { const newItem = item . data ; newItem . url = `/${ newItem . name }` ; newItem . redirectTo = item . redirectTo ; return newItem ; } ) : [ ] ; } @ Input ( ) languages : Language [ ] ; @ Input ( ) current : Language ; @ Output ( ) currentChange = new EventEmitter < Language > ( ) ; private _childrenRoutes : Routes ; constructor ( public router ) { } ngOnInit ( ) { } }