Allows navigation around the nav tree contained within the given rootElement. If there is no nav tree, all operations simply do nothing. For a full example, see vir-test-app.element.ts.

import {NavController, NavDirection} from 'device-navigation';

const navController = new NavController(host);

window.addEventListener('keydown', (event) => {
if (event.code === 'ArrowDown') {
navController.navigate({
direction: NavDirection.Down,
allowWrapper: false,
});
} else if (event.code === 'ArrowUp') {
navController.navigate({
direction: NavDirection.Up,
allowWrapper: false,
});
}
// etc. all other navigation directions
});

Constructors

Properties

rootElement: HTMLElement

The parent of all navigable elements. If this element also has nav() applied to it, it will be ignored.

Methods