Angularjs 访问angular js中另一个子对象中的子作用域属性

Angularjs 访问angular js中另一个子对象中的子作用域属性,angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat,Angularjs,Angularjs Directive,Angularjs Scope,Angularjs Ng Repeat,可以访问angular js中的同级属性吗?我有一个父母和两个孩子 我的父母是我的父母 儿童是:- 1. <li ng-repeat= "item in list"/> 2. and within ng-repeat i have a custom directive <directive1></directive1> 1 2.在ng repeat中,我有一个自定义指令 根据项目类型,可以有不同的指令,因此我在项目中获取指令作为属性 i.e. item

可以访问angular js中的同级属性吗?我有一个父母和两个孩子

我的父母是我的父母

儿童是:-

1. <li ng-repeat= "item in list"/>

2. and within ng-repeat i have a custom directive  <directive1></directive1>
1
  • 2.在ng repeat中,我有一个自定义指令
  • 根据项目类型,可以有不同的指令,因此我在项目中获取指令作为属性

    i.e. item.directive= "<div directive1> </directive>"
    
    即item.directive=“”
    
    我编译上面的html以便调用directive1的代码

    现在如何访问directive1的链接函数中的“项”


    link:函数有作用域,它有一个属性$$childTail。这显示了属于ng repeat子作用域的项!是否建议使用它?还是有工作要做?谢谢

    您可以将作用域变量传递到指令中,并在link函数中使用它们

    <div directive some-var="item"></div>
    
    scope: {
      someVar: '='
    },
    link: funciton (scope, element, attr) {
       // outputs the contents of 'item' from the parent scope.
       console.log(scope.someVar);
    }