aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons/edit-button.component.ts
blob: 4b76551ca93c84b73aeafdf9669b7713fcd1eb60 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                        






                                             
                                                    
                        
                        
                                             
 


                                                  
                                    



                                                 
                                    





                               
 
import { Component, Input, OnInit } from '@angular/core'

@Component({
  selector: 'my-edit-button',
  styleUrls: [ './button.component.scss' ],
  templateUrl: './edit-button.component.html'
})

export class EditButtonComponent implements OnInit {
  @Input() label: string
  @Input() title: string
  @Input() routerLink: string[] | string = []

  ngOnInit () {
    // <my-edit-button /> No label
    if (this.label === undefined && !this.title) {
      this.title = $localize`Update`
    }

    // <my-edit-button label /> Use default label
    if (this.label === '') {
      this.label = $localize`Update`

      if (!this.title) {
        this.title = this.label
      }
    }
  }
}