I am facing an issue with a textbox that should display a certain value even after being deleted. When the input is cleared and clicked away from, I want the value to reappear in the textbox.
Currently, there seems to be a problem with this functionality not working as expected.
Here is the relevant HTML code:
<input type="number" ng-blur="$ctrl.blur('max')"
ng-change="$ctrl.updateY('max')" ng-model-options="{debounce: 500}"
ng-model="$ctrl.max">
And here is the associated JavaScript code:
blur(which) {
if(which === 'max') {
if(!this.max) {
this.max = this.maxValue;
}
}
}
updateY(which) {
if(which === 'max') {
if(this.max) {
this.maxValue = this.max;
}
}
const maxNumber = Number(this.maxValue);
this.lineView.chart.axis.range({max: {y: maxNumber}, min: {y: maxNumber-100}});
}
Currently, if the value in the textbox is deleted and then clicked away from anywhere on the screen, the value does not automatically reappear in the textbox. It only works if you click back into the textbox after deleting.
My goal is to have the value rewritten back in the textbox even when clicking outside of it. Is this achievable?