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
Javascript 删除某些元素上的子角度指令_Javascript_Angularjs_Angularjs Directive_Angular Bootstrap - Fatal编程技术网

Javascript 删除某些元素上的子角度指令

Javascript 删除某些元素上的子角度指令,javascript,angularjs,angularjs-directive,angular-bootstrap,Javascript,Angularjs,Angularjs Directive,Angular Bootstrap,我有指示 class MyDirective constructor: (@$compile) -> return { scope: var1: "=" var2: "=" restrict: 'A' templateUrl: 'views/template.html' } app.directive 'emDir', ['$compile', MyDirective] 具有此类型的tem

我有指示

class MyDirective

  constructor: (@$compile) ->
      return {
      scope:
        var1: "="
        var2: "="
      restrict: 'A'
      templateUrl: 'views/template.html'
      }

app.directive 'emDir', ['$compile', MyDirective]
具有此类型的template.html

<div uib-popover-template="dynamicPopover.templateUrl" popover-trigger="mouseenter">
</div>

此指令在我的html上使用ng repeat重复多次

因此,任何重复元素在mouseenter上都有一个popover。但我只需要为某些元素制作popover,而不是所有元素

我试着这么做

link = (scope, element, attrs) =>
    if scope.var1 < scope.var2
                    scope.$watch(
                          element.children().removeAttr('uib-popover-template')
                          element.children().removeAttr('popover-trigger')
                          $compile(element.children())(scope)
                    )
link=(范围、元素、属性)=>
如果scope.var1
之后,属性被删除,但所有元素的鼠标指针上仍显示popover。这个也一样

compile: (element, attrs) =>
            pre: (scope, element, attrs) =>
                    if scope.var1 < scope.var2
                        element.children().removeAttr('uib-popover-template')
                        element.children().removeAttr('popover-trigger')
compile:(元素,属性)=>
前置:(范围、元素、属性)=>
如果scope.var1
我也试过了

compile: (element, attrs) =>
       if attrs.var1 < attrs.var2
            element.children().removeAttr('uib-popover-template')
            element.children().removeAttr('popover-trigger')
            element.children().removeAttr('popover-popup-close-delay')
compile:(元素,属性)=>
如果attrs.var1
在本例中,所有元素的popover都会消失,但我只需要对某些元素使用它


我如何才能做到这一点?

如果您能提供一个演示上述内容的工作演示,那将很有帮助。