根据this solution我构建了我的AngularJS应用。现在,我想在嵌套结构中访问父级的值。

我试过了,但是不起作用: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>


有什么办法吗?
谢谢

最佳答案

哈哈,太容易了;-)
解决方法如下: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>

关于javascript - 带有AngularJS的JSON:嵌套ng-repeat中的父级,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24382653/

10-12 00:46