Hi,

I have some table html and having trouble ng-repeating from json data with 
multiple levels.

I have the TR working, creating a list of employee names each in a *TD,* 
however 
I cannot make the second TD repeat for each Timestamp in each first row of 
absence which should create 7 TDs.

Any idea what might I be doing wrong?

When I manage to get this working I would also need to create multiple TRs 
for each Absence with TDs for each Timestamp (probably need ng-repeat-start 
/ end) for each employee. I would appreciate any helpful pointers to that.


staff-calendar-table-row.html
<tr ng-repeat="row in staffCalendar.data.Employee">
  <td>{{row.Details.DisplayName}}</td>
  <td ng-repeat="absence in row.Absence[0].Timestamp">cell - {{$index}}</td>
</tr>


Json Data:
{
  "d": {
    "__type": 
"IntegratedCalendarDetails:#Common.Entities.Integrated_Calendar",
    "Employee": [{
        "__type": "Employee:#Common.Entities.Integrated_Calendar",
        "Absence": [{
            "__type": "Absence:#Common.Entities.Integrated_Calendar",
            "Timestamp": ["\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", 
"\/Date(1443650400000+0200)\/", "\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
            "Type": "Vacation Leave"
          }
        ],
        "Details": {
          "__type": "User:#Common.Entities",
          "DisplayName": "Alan"
        }
      }, {
        "__type": "Employee:#Common.Entities.Integrated_Calendar",
        "Absence": [{
            "__type": "Absence:#Common.Entities.Integrated_Calendar",
            "Timestamp": ["\/Date(-62135596800000)\/", 
"\/Date(1443477600000+0200)\/", "\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
            "Type": "Other Leave"
          }
        ],
        "Details": {
          "__type": "User:#Common.Entities",
          "DisplayName": "Alistair"
        }
      }, {
        "__type": "Employee:#Common.Entities.Integrated_Calendar",
        "Absence": [{
            "__type": "Absence:#Common.Entities.Integrated_Calendar",
            "Timestamp": ["\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(1443736800000+0200)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
            "Type": "Vacation Leave"
          }, {
            "__type": "Absence:#Common.Entities.Integrated_Calendar",
            "Timestamp": ["\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(1443564000000+0200)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/", 
"\/Date(-62135596800000)\/", "\/Date(-62135596800000)\/"],
            "Type": "Working from Home"
          }
        ],
        "Details": {
          "__type": "User:#Common.Entities",
          "DisplayName": "Andrew"
        }
      }
    ]
  }
}


Table HTML:
 <table class="table table-bordered">
 <thead class="thin-border-bottom" staff-calendar-table-head></thead>
 <tbody staff-calendar-table-row></tbody>
 </table>

Directive Code:
  module.directive('staffCalendarTableRow', [function(){
    return {
      restrict: 'A',
      templateUrl: 
'features/staff-calendar/partials/staff-calendar-table-row.html',
      controller: function($scope) {
        
      },
      controllerAs: 'StaffCalendarController'
    }
  }]);


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to