]>
Commit | Line | Data |
---|---|---|
1 | import { Component, Input, OnInit } from '@angular/core' | |
2 | ||
3 | @Component({ | |
4 | selector: 'my-edit-button', | |
5 | template: ` | |
6 | <my-button | |
7 | icon="edit" className="grey-button-link" | |
8 | [label]="label" [title]="title" [responsiveLabel]="responsiveLabel" | |
9 | [routerLink]="routerLink" | |
10 | ></my-button> | |
11 | ` | |
12 | }) | |
13 | export class EditButtonComponent implements OnInit { | |
14 | @Input() label: string | |
15 | @Input() title: string | |
16 | @Input() routerLink: string[] | string = [] | |
17 | @Input() responsiveLabel = false | |
18 | ||
19 | ngOnInit () { | |
20 | // <my-edit-button /> No label | |
21 | if (this.label === undefined && !this.title) { | |
22 | this.title = $localize`Update` | |
23 | } | |
24 | ||
25 | // <my-edit-button label /> Use default label | |
26 | if (this.label === '') { | |
27 | this.label = $localize`Update` | |
28 | } | |
29 | } | |
30 | } |