]>
Commit | Line | Data |
---|---|---|
1 | import { Component, Input, OnInit } from '@angular/core' | |
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | |
3 | ||
4 | @Component({ | |
5 | selector: 'my-delete-button', | |
6 | styleUrls: [ './button.component.scss' ], | |
7 | templateUrl: './delete-button.component.html' | |
8 | }) | |
9 | ||
10 | export class DeleteButtonComponent implements OnInit { | |
11 | @Input() label: string | |
12 | @Input() title: string | |
13 | ||
14 | constructor (private i18n: I18n) { } | |
15 | ||
16 | ngOnInit () { | |
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 | } | |
30 | } | |
31 | } |