// Angular imports // import { Component, OnInit, Inject, Output, EventEmitter } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { downgradeComponent } from '@angular/upgrade/static'; declare const angular: angular.IAngularStatic; const styles: any[] = [require('./fb-side-drawer-back-button.component.less')]; @Component({ selector: 'fb-side-drawer-back-button', templateUrl: './fb-side-drawer-back-button.component.html', styles: styles }) export class FbSideDrawerBackButtonComponent implements OnInit { @Output() onClose: EventEmitter = new EventEmitter(); buttonText: string; existPrevious: boolean; constructor( @Inject('SideDrawerService') private readonly sideDrawerService: fb.ISideDrawerService, private readonly translate: TranslateService ) { } ngOnInit(): void { const previous: fb.IDrawer = this.sideDrawerService.previousInStack(); this.existPrevious = !!previous; this.buttonText = this.existPrevious ? this.sideDrawerService.getSideDrawerTitle(previous) : null; this.buttonText = this.buttonText || this.translate.instant('GLOBALS.STAENG'); } isLocked(): boolean { return this.sideDrawerService.isLocked(); } closeDrawer(): void { this.onClose.emit({}); this.sideDrawerService.closeCurrentSideDrawer(false); } } angular.module('fasit') .directive('fbSideDrawerBackButton', downgradeComponent({ component: FbSideDrawerBackButtonComponent, inputs: [], outputs: ['onClose'] }) as angular.IDirectiveFactory);