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

@Component({
  selector: 'app-input-item',
  templateUrl: './input-item.component.html',
  styleUrls: ['./input-item.component.less']
})
export class InputItemComponent implements OnInit {
  @Input() label: string = 'title';
  @Input() labelStyle: any = '';
  @Input() type: 'text' | 'tel' = 'text';
  @Input() text: string = '';
  @Output() textChange = new EventEmitter<any>();
  @Input() maxLength: number = 20;

  constructor() {
  }

  ngOnInit(): void {
  }

  onInput(e: any) {
    this.text = e.target.value;
    this.textChange.emit(this.text);
  }
}
