import { Component , EventEmitter , OnDestroy , Output } from '@angular/core' ; import { WorksheetService } from '../services/worksheet.service' ; import { Subscription } from 'rxjs/Subscription' ; @ Component ( { selector : 'app-ribbon' , templateUrl : './ribbon.component.html' , styleUrls : [ './ribbon.component.css' ] } ) export class RibbonComponent implements OnDestroy { private subscription : Subscription ; selectionFormatState : any = { } ; @ Output ( ) ribbonClicked = new EventEmitter < any > ( ) ; constructor ( private worksheetService ) { this . subscription = this . worksheetService . getState ( ) . subscribe ( selectionFormatState => { this . selectionFormatState = selectionFormatState ; } ) ; } ngOnDestroy ( ) { this . subscription . unsubscribe ( ) ; } param { any } action example returns { void } command ( action ) { this . ribbonClicked . emit ( action ) ; } windowOpen ( ) { const params = 'width=300,height=400,left=100,top=100' ; window . open ( '/palette' , 'FloatingToolbar' , params ) ; } }