Issues with collapsible table row

Our team is trying to create a widget in ServiceNow that has expandable/collapsible rows. We’re having a lot of trouble getting it to work correctly. Below is our code so far:

<table class="table table-responsive">
  <thead>
    <tr>
      <th></th>
      <th ng-repeat="field in data.fields_array track by $index" ng-click="setOrderBy(field)" tabindex="0">
        <div class="th-title" aria-label="${Sort by } {{data.column_labels[field]}}">{{data.column_labels[field]}}
          <i class="fa" ng-if="field == data.o" ng-class="{'asc': 'fa-chevron-up', 'desc': 'fa-chevron-down'}[data.d]" aria-label="${Sorted by } {{data.column_labels[field]}} {{data.d == 'asc' ?  '${Ascending}': '${Descending}' }}"></i>
        </div>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="item in data.list track by item.sys_id" data-toggle="collapse" href="#{{item.pcs_task_type_sysID}}" aria-expanded="true" aria-controls="collapseOne" role="button">  <!--ng-click="expand(item)" class="clickableTableRow" -->   
      <td>
        <i ng-if="field[$index] == field[0]" ng-class="{'pull-center text-success glyphicon glyphicon-check' : item.completed !='Not Completed','text-danger glyphicon glyphicon-warning-sign' : item.completed == 'Not Completed'}"></i>
      </td>
      <td role="text" aria-label="{{item[field].display_value}}" class="pointer" ng-class="{selected: item.selected}" ng-repeat="field in ::data.fields_array track by $index" data-field="{{::field}}" data-th="{{::data.column_labels[field]}}">
        {{::item[field].display_value}}
      </td>
      <td>
        <div id="{{item.pcs_task_type_sysID}}" class="collapse">
          <sp-widget widget="item.widget"></sp-widget>
        </div>
      </td>
    </tr>
  </tbody>
</table>

The above code produces the following (which is obviously incorrect):

enter image description here

I know that instead of , that the collapsible div should be in a , however when I move that down to it’s own row like the following, the new row will not expand at all.

<table class="table table-responsive">
      <thead>
        <tr>
          <th></th>
          <th ng-repeat="field in data.fields_array track by $index" ng-click="setOrderBy(field)" tabindex="0">
            <div class="th-title" aria-label="${Sort by } {{data.column_labels[field]}}">{{data.column_labels[field]}}
              <i class="fa" ng-if="field == data.o" ng-class="{'asc': 'fa-chevron-up', 'desc': 'fa-chevron-down'}[data.d]" aria-label="${Sorted by } {{data.column_labels[field]}} {{data.d == 'asc' ?  '${Ascending}': '${Descending}' }}"></i>
            </div>
          </th>
        </tr>
      </thead>
      <tbody> <!-- id="{{item.sys_id}}_task_body" class="panel-collapse collapse in dataBlock"-->
        <tr ng-repeat="item in data.list track by item.sys_id" data-toggle="collapse" href="#{{item.pcs_task_type_sysID}}" aria-expanded="true" aria-controls="collapseOne" role="button">  <!--ng-click="expand(item)" class="clickableTableRow" -->   
          <td>
            <i ng-if="field[$index] == field[0]" ng-class="{'pull-center text-success glyphicon glyphicon-check' : item.completed !='Not Completed','text-danger glyphicon glyphicon-warning-sign' : item.completed == 'Not Completed'}"></i>
          </td>
          <td role="text" aria-label="{{item[field].display_value}}" class="pointer" ng-class="{selected: item.selected}" ng-repeat="field in ::data.fields_array track by $index" data-field="{{::field}}" data-th="{{::data.column_labels[field]}}">
            {{::item[field].display_value}}
          </td>
        </tr>
        <tr>
          <td>
            <div id="{{item.pcs_task_type_sysID}}" class="collapse"><!--ng-if="item.showDescriptor" -->
              <sp-widget widget="item.widget"></sp-widget>
            </div>
          </td>
        </tr>
      </tbody>
    </table>

What are we missing to get this to work correctly?

Source: AngularJS