import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core'; import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; @Component({ selector: 'hbor-iznos', templateUrl: './iznos.component.html', styleUrls: ['./iznos.component.css'] }) export class IznosComponent implements OnInit, OnChanges { @Output() onIznosChange: EventEmitter = new EventEmitter(); @Input() disabled = false; @Input() placeholder = 'Iznos'; @Input() floatLabel = 'auto'; @Input() errorMessageRequired = 'Polje je obavezno'; @Input() errorMessageCustom = ''; @Input() customErrorMessage; @Input() hborFormControl: FormControl; @Input() width = 180; @Input() max = 9999999999999999; @Input() min = -999999999999999; @Input() mask = { prefix: '', thousands: '.', decimal: ',', allowNegative: true }; constructor() { } ngOnInit() { this.hborFormControl.valueChanges.subscribe(() => { this.onIznosChange.emit(this.hborFormControl.value); }) } ngOnChanges() { } }