I need to use Observables instead of document.querySelector in Angular 6. My code looks now like this:
onInputChange(result: string) {
const x = document.querySelector('.x') as HTMLElement;
if (result[0] === '4') {
x.style.backgroundColor = '#ffffff';
} else if (result[0] === '5' && result[1] === '5') {
x.style.backgroundColor = '#000000';
} else if (result[0] === '_') {
x.style.backgroundColor = '#AFB8BD';
}
result = result.replace(new RegExp('u', 'g'), 'x');
(<HTMLInputElement>document.getElementById('someInput')).value = result;
}
Actually, the main idea is to change color of the background regarding the first number of "result" input Could someone help me to use Observables? I'm new in Frontend so sorry for this question