import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';

@Component({
  selector: 'app-specific-value',
  templateUrl: './specific-value.component.html',
  styleUrls: ['./specific-value.component.css']
})
export class SpecificValueComponent {
  valueInputControl = new FormControl('');

  validateNumber(value: string){
    let validChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
    let valueArr = value.split('');
    let validVal = ''

    valueArr.forEach(char => {
      if(validChars.includes(char)){
        validVal += char;
      }
    });

    this.valueInputControl.setValue(validVal);
  }
}
