import { ChangeDetectionStrategy , Component , EventEmitter , Input , Output , } from '@angular/core' ; import { TrendingService } from '../service/trending.service' ; import { Observable } from 'rxjs' ; import { map } from 'rxjs/operators' ; import { ConfigsService } from '../../../common/services/configs.service' ; @ Component ( { selector : 'm-hashtags__trending' , changeDetection : ChangeDetectionStrategy . OnPush , templateUrl : 'trending.component.html' , } ) export class TrendingComponent { @ Input ( ) decoration : boolean = true ; @ Output ( 'onAction' ) onActionEmitter : EventEmitter < string > = new EventEmitter < string > ( ) ; /**
     * Trending list
     */ readonly trending$ : Observable < string [ ] > = this . service . tags$ . pipe ( map ( tags => tags . slice ( 0 , 10 ) ) ) ; /**
     * CDN assets URL
     */ readonly cdnAssetsUrl : string ; param service param configs constructor ( protected service , configs ) { this . cdnAssetsUrl = configs . get ( 'cdn_assets_url' ) ; } /**
     * Initialization (load trending hashtags)
     */ ngOnInit ( ) { this . service . load ( ) ; } param tag onAction ( tag ) { this . onActionEmitter . emit ( tag ) ; } }