Reputation: 516
I wanted to have a tab index on non-form elements ex: div tag for that, I used tab index but when my div focussed and enter button tapped its not trigging ng-click which div tag has
<div tabindex="0" role="button"
ng-click="!user.Active || selectUser(user)"
class="multi-user no-outline"
ng-repeat="user in Users" >
<div class="bold text-capitalize text-primary" ng-bind="user.Name"></div>
<small class="text-capitalize" ng-bind="user.RoleName"></small>
<label class="label rel-label"
ng-if="user.Active !== true">
Deactive
</label>
</div>
Upvotes: 0
Views: 35
Reputation: 1075467
I don't do AngularJS, but pressing Enter doesn't generate a click (except on radio buttons and checkboxes), it generates keydown
, keypress
, and keyup
events. You probably want ng-keypress
. You'll need to check $event
's key
(or keyCode
for older browsers) to see if it was Enter that was pressed.
Upvotes: 2