单个html元素的多个上下文菜单

时间:2016-08-03 06:31:40

标签: javascript html contextmenu

我想在单个元素td右键单击上有两个不同的上下文菜单。 我的HTML代码就像。

<td context-menu="otherMenuOptions"  model="val['origin']['ip']"><span ng-show="!val['origin']['ip']">-</span> <a href="#/app/showIps/{{val['destination']['countryCode']}}/ip/{{val['origin']['ip']}}" target="_blank">{{val['origin']['ip']}} </a> </td>

我的jscode如下: 上下文菜单1:

     $scope.otherMenuOptions = [
        ['Add into Search', function ($itemScope, $event, color) {
             if($scope.demo['tags'] != undefined){
                  if($scope.demo['tags'].length >= 1){

                    var check = _.filter($scope.demo['tags'], function(num){
                            return num['text'] === color; });
                    //console.log(check);       
                    if(check.length == 0){
                        $scope.demo['tags'].push({text:color});
                    }else{
                        //alert("match");
                    }
                  }else { $scope.demo['tags'] = [];
                          $scope.demo['tags'].push({text:color});
                        }                   
            }else{

                $scope.demo['tags'] = [];
                $scope.demo['tags'].push(color);

            }
        }]
    ];

上下文菜单2:

$scope.whiteList=[  ['Add to white list', function ($itemScope, $event, ip) {
    whiteList($itemScope.$parent.item.data.Ip);
}]]

我想在同一次点击中执行两个上下文菜单。

0 个答案:

没有答案