0

我正在寻找可用于从以下 json 生成输出的模板。

寻找外部循环的模板(必须显示标题(从早上 7:00 到下午 1:45 等的会话),值也可以从嵌套列表中获得,然后继续内部循环,我已经完成了内循环,但想知道如何处理外循环。

{  
   "Sessions from 7:00 am to 1:45 pm":[  
      {  
         "id":24,
         "name":"Breakfast",
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
      {  
         "id":25,
         "name":"Opening Address",
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
      {  
         "id":26,
         "name":"Auto Finance p",
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
      {  
         "id":27,
         "name":"25 Years of Democratizing Access to Credit",
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
      {  
         "id":28,
         "name":"Key Steps to Better Credit Line Management",
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
      {  
         "id":29,
         "group_header":"Sessions from 7:00 am to 1:45 pm"
      },
   ]
},
{  
   "Sessions from 8:00 am to 1:30 pm":[  
      {  
         "id":66,
         "name":"General Session",
         "group_header":"Sessions from 8:00 am to 1:30 pm"
      },
      {  
         "id":67,
         "name":"Addressing Attrition: ",
         "group_header":"Sessions from 8:00 am to 1:30 pm"
      },
      {  
         "id":68,
         "name":"Regulatory Olympics: Why Conduct Risk Matters - Panel Discussion",
         "group_header":"Sessions from 8:00 am to 1:30 pm"
      }
   ]
}
<ul class="table-view">
        <li class="table-view-cell" ng-repeat="session in sessions">
            <ul class="cell">
                <li class="cell-content">
                    <div class="session" ng-class-odd="'odd'" ng-class-even="'even'">
                        <span class="name">{{session.name}}</span>
                    </div>
                </li>
            </ul>
        </li>
    </ul>

4

2 回答 2

0

这是你想要的吗 ??

    <ul class="table-view">
            <li class="table-view-cell" ng-repeat="(key, value) in sessions">
              <div ng-repeat="(k, v) in value">
              {{k}}
                  <ul class="cell">
                      <li class="cell-content">
                          <div class="session" ng-repeat="val in v" ng-class-odd="'odd'" ng-class-even="'even'">
                              <span class="name">{{val.name}}</span>
                          </div>
                      </li>
                  </ul>
              </div>
            </li>
        </ul>

输出可以在这里看到

于 2014-11-10T05:08:42.957 回答
0

您可以参考下面的 plunkr 代码。我希望这是你的要求。如果仍然缺少某些东西,请告诉我,我会尽力帮助您。

http://plnkr.co/edit/TmS3ufeC8S98LtJgOyve?p=preview

<div ng-repeat="(heading,session) in sessions">
  <h3>{{heading}}</h3>
  <div ng-repeat="val in session">
    <span>{{val.name}}</span>
  </div>
</div>
于 2014-11-10T06:10:08.233 回答