tempid
tempid

Reputation: 8208

Navigating the page using keyboard

I have a page built using AngularJS which displays the list of thumbnails of pictures in an album. How do I navigate through the thumbnails with keyboard? The focus should start on the first thumbnail, and when I click on the right/left arrows on the keyboard, the focus should move accordingly. Hitting the ENTER key should trigger the ng-click event. Is this possible? The code -

<div id="album">
        <ul id="photosList">
            <li ng-repeat="photo in photos">
                <img ng-src="{{photo.url}}" ng-click="details(photo.id)"/>
            </li>
        </ul>        
    </div>

Upvotes: 1

Views: 376

Answers (1)

Calvin Cheng
Calvin Cheng

Reputation: 36506

Use the ui-keypress bindings?

Reference - stackoverflow.com/questions/12816420/keypress-in-angular-ui

<img ng-src="{{photo.url}}" ui-keypress="{enter: details(photo.id)}"/>

Upvotes: 1

Related Questions