blob: a578f03940273e2f679b0f199b2b82cabe58818a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { Location } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
@Component({
selector: 'cd-back-button',
templateUrl: './back-button.component.html',
styleUrls: ['./back-button.component.scss']
})
export class BackButtonComponent {
@Output() backAction = new EventEmitter();
@Input() name: string = this.actionLabels.CANCEL;
constructor(private location: Location, private actionLabels: ActionLabelsI18n) {}
back() {
if (this.backAction.observers.length === 0) {
this.location.back();
} else {
this.backAction.emit();
}
}
}
|