简体   繁体   English

带有AngularJS的JSON:嵌套ng-repeat中的父级

[英]JSON with AngularJS: parent in nested ng-repeat

according to this solution i built my AngularJS app. 根据此解决方案,我构建了AngularJS应用。 Now i want to access a parent's value within a nested structure. 现在,我想嵌套结构中访问父级的值。

I tried this, but it does not work: http://jsfiddle.net/BwDAP/ 我试过了,但是不起作用: http : //jsfiddle.net/BwDAP/

<body  ng-app="WeeklyApp" ng-controller="WeeklyController" >
    <div ng-repeat="week in myData">
       <div ng-repeat="day in week.days">
          {{day.dow}} - {{day.templateDay}}
          <b>Jobs:</b><br/> 
           <ul>
             <li ng-repeat="job in day.jobs"> 
               {{job.name}} 
                 <br />
               <!-- PARENT -->
               parent: {{job.parent.dow}} 
             </li>
           </ul>
       </div>
    </div>
</body>

Any solutions? 有什么办法吗? thx 谢谢

A haha, too easy ;-) Here is the solution: http://jsfiddle.net/Lm6KZ/ 哈哈,太简单了;-)这是解决方法: http : //jsfiddle.net/Lm6KZ/

<body  ng-app="WeeklyApp" ng-controller="WeeklyController" >
    <div ng-repeat="week in myData">
       <div ng-repeat="day in week.days">
          {{day.dow}} - {{day.templateDay}}
          <b>Jobs:</b><br/> 
           <ul>
             <li ng-repeat="job in day.jobs"> 
               {{job.name}} 
                 <br />
               <!-- PARENT -->
               parent: {{day.dow}} 
             </li>
           </ul>
       </div>
    </div>
</body>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM