(function() {
var table = {
thead: [{
header: "A",
subheaders: [
"A1",
"A2"
]
}, {
header: "B",
subheaders: [
"B1",
"B2",
"B3"
]
}, {
header: "C",
subheaders: [
"C1",
"C2",
"C3"
]
}]
};
var app = angular.module("app", []);
app.controller("Controller", function() {
var vm = this;
vm.table = table;
vm.subArray = [];
vm.subs = function(table) {
angular.forEach(vm.table.thead, function(header) {
angular.forEach(header.subheaders, function(subheader) {
vm.subArray.push(subheader)
})
})
};
vm.subs();
});
})()
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<div ng-app="app">
<div ng-controller="Controller as ctrl">
<h1>Some table</h1>
<table class="table table-bordered">
<thead>
<tr>
<th ng-repeat="head in ctrl.table.thead" colspan="{{head.subheaders.length}}">{{head.header}}</th>
</tr>
<tr>
<th ng-repeat="sub in ctrl.subArray">{{sub}}</th>
</tr>
</thead>
<tbody>
<tr>
<td ng-repeat="i in [1, 2, 3, 4, 5, 6, 7, 8]">{{i}}</td>
</tr>
</tbody>
</table>
</div>
</div>