2017-06-13 62 views
1

我想是這樣做的:如何獲取當前節點的父代Angular UI樹?

$scope.showCloneIcon = function(scope) 
     { 

      if(scope.$parentNodeScope !== null){ 

       var parent_value = scope.$parentNodeScope.$modelValue.type_value; 

       if(parent_value === 'array_objects'){ 
        return true; 
       } 
      } 

      return true; 
     }; 

所以,它不會在這裏我用NG-顯示

+3

範圍$家長會工作。 – 2017-06-13 07:07:16

回答

1

隱藏元素,請試試這個

$scope.showCloneIcon = function(scope) 
{ 
    if(scope.$parent !== null) 
    { 
    var parent_value = scope.$parent.$modelValue.type_value; 
    if(parent_value === 'array_objects') 
    { 
     return true; 
    } 
    } 
    return true; 
};