Handle Events

You can subscribe to an event using a configuration option. All event handling options are given names that 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