Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs ng禁用不';不能在SVG元素中工作_Angularjs_Svg_Angularjs Directive_Angularjs Ng Disabled - Fatal编程技术网

Angularjs ng禁用不';不能在SVG元素中工作

Angularjs ng禁用不';不能在SVG元素中工作,angularjs,svg,angularjs-directive,angularjs-ng-disabled,Angularjs,Svg,Angularjs Directive,Angularjs Ng Disabled,我正在研究一个angularjs指令,其中一个圆圈元素一旦被点击,就需要被禁用。 ng click事件按预期工作,但ng disable不工作。我可以看到禁用的类被添加到html中,但是单击事件仍然被触发 有什么想法吗 <svg width="100" height="100"> <circle ng-disabled="disableme" ng-click="clickme()" ng-init="count=0" cx="50" cy="50" r="40"

我正在研究一个angularjs指令,其中一个圆圈元素一旦被点击,就需要被禁用。 ng click事件按预期工作,但ng disable不工作。我可以看到禁用的类被添加到html中,但是单击事件仍然被触发

有什么想法吗

<svg width="100" height="100">
      <circle ng-disabled="disableme" ng-click="clickme()" ng-init="count=0" cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
    </svg>

app.controller('MainCtrl', function($scope) {
  $scope.name = 'World';
  $scope.clickme = function () {
    $scope.count=$scope.count+1;
    $scope.disableme = true;
  };

应用程序控制器('MainCtrl',函数($scope){
$scope.name='World';
$scope.clickme=函数(){
$scope.count=$scope.count+1;
$scope.disableme=true;
};

ng disabled
在svg上不起作用。或者,您可以使用
ng类执行此操作

.disable {
     pointer-events: none;
     opacity: 0.5; 
 }
ng类
添加到
svg
元素中

 <svg width="100" height="100"  ng-class="{'disable': disableme}">
      <circle ng-click="clickme()" ng-init="count=0" cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
    </svg>