]>
Commit | Line | Data |
---|---|---|
8c6781e9 | 1 | import { Component, Input, OnInit } from '@angular/core' |
60709df5 | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
cd83ea1b C |
3 | |
4 | @Component({ | |
5 | selector: 'my-delete-button', | |
6 | styleUrls: [ './button.component.scss' ], | |
7 | templateUrl: './delete-button.component.html' | |
8 | }) | |
9 | ||
8c6781e9 | 10 | export class DeleteButtonComponent implements OnInit { |
eacb25c4 | 11 | @Input() label: string |
30814423 | 12 | @Input() title: string |
8c6781e9 | 13 | |
60709df5 C |
14 | constructor (private i18n: I18n) { } |
15 | ||
8c6781e9 | 16 | ngOnInit () { |
30814423 K |
17 | // <my-delete-button /> No label |
18 | if (this.label === undefined && !this.title) { | |
19 | this.title = this.i18n('Delete') | |
20 | } | |
21 | ||
22 | // <my-delete-button label /> Use default label | |
23 | if (this.label === '') { | |
24 | this.label = this.i18n('Delete') | |
25 | ||
26 | if (!this.title) { | |
27 | this.title = this.label | |
28 | } | |
29 | } | |
60709df5 | 30 | } |
cd83ea1b | 31 | } |