Skip to content

Commit de1a380

Browse files
committed
Formatting changes. contextMenuTag to model.
1 parent 2f2a0f5 commit de1a380

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

contextMenu.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
angular.module('ui.bootstrap.contextMenu', [])
22

33
.directive('contextMenu', ["$parse", function ($parse) {
4-
var renderContextMenu = function ($scope, event, options, tag) {
4+
var renderContextMenu = function ($scope, event, options, model) {
55
if (!$) { var $ = angular.element; }
66
$(event.currentTarget).addClass('context');
77
var $contextMenu = $('<div>');
@@ -25,18 +25,18 @@ angular.module('ui.bootstrap.contextMenu', [])
2525
var text = typeof item[0] == 'string' ? item[0] : item[0].call($scope, $scope, event);
2626
$a.text(text);
2727
$li.append($a);
28-
var enabled = angular.isDefined(item[2]) ? item[2].call($scope, $scope, event, text, tag) : true;
29-
if ( enabled ) {
30-
$li.on( 'click', function( $event ) {
28+
var enabled = angular.isDefined(item[2]) ? item[2].call($scope, $scope, event, text, model) : true;
29+
if (enabled) {
30+
$li.on('click', function ($event) {
3131
$event.preventDefault();
32-
$scope.$apply( function() {
33-
$( event.currentTarget ).removeClass( 'context' );
32+
$scope.$apply(function () {
33+
$(event.currentTarget).removeClass('context');
3434
$contextMenu.remove();
35-
item[1].call( $scope, $scope, event, tag );
36-
} );
37-
} );
35+
item[1].call($scope, $scope, event, model);
36+
});
37+
});
3838
} else {
39-
$li.on( 'click', function( $event ) {
39+
$li.on('click', function ($event) {
4040
$event.preventDefault();
4141
});
4242
$li.addClass('disabled');
@@ -75,10 +75,10 @@ angular.module('ui.bootstrap.contextMenu', [])
7575
$scope.$apply(function () {
7676
event.preventDefault();
7777
var options = $scope.$eval(attrs.contextMenu);
78-
var tag = $scope.$eval(attrs.contextMenuTag);
78+
var model = $scope.$eval(attrs.model);
7979
if (options instanceof Array) {
8080
if (options.length === 0) { return; }
81-
renderContextMenu($scope, event, options, tag);
81+
renderContextMenu($scope, event, options, model);
8282
} else {
8383
throw '"' + attrs.contextMenu + '" not an array';
8484
}

0 commit comments

Comments
 (0)