I have a text-box to show a input field on click and hide it on blur. The problem is when the input is shown, it is not auto-focused. The blur only works if you click the text-box, then click the input. But when you click the text-box once and go somewhere else, you can still see the input. Is it possible to auto-focus the input field on click? or maybe there is a better way to do this?
<div data-ng-init="editMode = false">
<p data-ng-show="!editMode" data-ng-click="editMode = true">{{color}}</p>
<span data-ng-show="editMode">
<input data-ng-blur="editMode = false" data-ng-model="color">
</span>
</div>
Thanks in advance for your help!