Help us shape the 2021 DevExtreme Roadmap. Take our 5 minute survey.
Dismiss

Handle Events

IMPORTANT
AngularJS is now in Long Term Support. You can continue to use it in existing projects but we recommend Angular, Vue, React, or another framework for new projects.

You can use a configuration option to subscribe to an event. All event handling options' names begin with on.

HTML
JavaScript
<div dx-menu="{
    ...
    onItemClick: itemClickHandler,
    onInitializedHandler: initializedHandler
 }"></div>
function Controller ($scope) {
    $scope.itemClickHandler = function (info) {
        // Handles the "itemClick" event
    };
    $scope.menuInstance = {};
    $scope.initializedHandler = function (info) {
        // Saves the widget instance
        $scope.menuInstance = info.component;   
        // Handles the "initialized" event
    }
}

View Demo

See Also
  • API Reference.WidgetName.Events, for example, API Reference.Menu.Events