I am having difficulty manually setting the focus on an input element using $event.currentTarget.focus();
. Despite following the correct syntax, it seems to not be functioning as intended. Below is a snippet of what I am trying to accomplish:
HTML:
<div ng-repeat="item in items track by $index" ng-dblclick="onDblClick($event,item)">
<input type="text" ng-model="item.id" ng-disabled="!item.editing" ng-blur="onBlur(item)">
</div>
Script:
$scope.onDblClick = function($event, item) {
item.editing = true;
//setting the focus to elemnt but don't know why it's not working
$event.currentTarget.focus();
};
To view this issue in action, visit the plunkr.