Closed tgibson1 closed 4 years ago
var clickFunction = angular.isFunction(item.click) ? item.click : (angular.isFunction(item[1]) ? item[1] : null);
if (clickFunction) { var res = clickFunction.call($scope, $scope, event, modelValue, text, $li); if (res === undefined || res) { cleanupFunction(); } } else { cleanupFunction(); }
The click handler is always null eventhough I am assigning a function to it in the controller (controller below)
$scope.menuOptions = [ // NEW IMPLEMENTATION { text: 'Object-Select', click: function ($itemScope, $event, modelValue, text, $li) { alert("Contact Service Provider"); $scope.selected = $itemScope.item.name; } }, { text: 'Object-Remove', click: function ($itemScope, $event, modelValue, text, $li) { alert("Contact Service Provider"); $scope.items.splice($itemScope.$index, 1); } }, // LEGACY IMPLEMENTATION ['Select', function ($itemScope, $event, modelValue, text, $li) { alert("Contact Service Provider"); $scope.selected = $itemScope.item.name; }], null, // Dividier ['Remove', function ($itemScope, $event, modelValue, text, $li) { alert("Contact Service Provider"); $scope.items.splice($itemScope.$index, 1); }] ];
issue was due to passing menu options using interpolation
wrong way: context-menu={{menuOptions}} correct way:context-menu=menuOptions
The click handler is always null eventhough I am assigning a function to it in the controller (controller below)