Having component's property called publicArray you can you can achive that by writing the following template:
<table *ngIf="publicArray?.settings?.length && publicArray.settings[0].data?.length">
<tr>
<th>ID</th>
<th *ngFor="let header of publicArray.settings[0].data">{{ header.title }}</th>
</tr>
<tr *ngFor="let row of publicArray.settings">
<td>{{ row.id }}</td>
<td *ngFor="let col of row.data">
{{ col.value }}
</td>
</tr>
</table>
Ng-run Example
Answer from yurzui on Stack OverflowHaving component's property called publicArray you can you can achive that by writing the following template:
<table *ngIf="publicArray?.settings?.length && publicArray.settings[0].data?.length">
<tr>
<th>ID</th>
<th *ngFor="let header of publicArray.settings[0].data">{{ header.title }}</th>
</tr>
<tr *ngFor="let row of publicArray.settings">
<td>{{ row.id }}</td>
<td *ngFor="let col of row.data">
{{ col.value }}
</td>
</tr>
</table>
Ng-run Example
<table>
<thead>
<th>ID</th>
<th>Business Unit</th>
<th>Comp</th>
<th>Pa Id</th>
<th>NPI</th>
</thead>
<tbody>
<tr *ngFor="let item of data.settings; let i=index">
<td>{{item.id}}</td>
<td *ngFor="let item2 of item.data">{{item2.value}}</td>
</tr>
</tbody>
</table>
stackblitz example

Videos
The solution you are looking for is in Angular's official tutorial. In this tutorial Phones are loaded from a JSON file using Angulars $http service . In the code below we use $http.get to load a phones.json file saved in the phones directory:
var phonecatApp = angular.module('phonecatApp', []);
phonecatApp.controller('PhoneListCtrl', function ($scope, $http) {
$http.get('phones/phones.json').success(function(data) {
$scope.phones = data;
});
$scope.orderProp = 'age';
});
We then iterate over the phones:
<table>
<tbody ng-repeat="i in phones">
<tr><td>{{i.name}}</td><td>{{$index}}</td></tr>
<tr ng-repeat="e in i.details">
<td>{{$index}}</td>
<td>{{e.foo}}</td>
<td>{{e.bar}}</td></tr>
</tbody>
</table>
Easy way to use for create dynamic header and cell in normal table :
<table width="100%" class="table">
<thead>
<tr>
<th ng-repeat="(header, value) in MyRecCollection[0]">{{header}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in MyRecCollection | filter:searchText">
<td ng-repeat="cell in row">{{cell}}</td>
</tr>
</tbody>
</table>
MyApp.controller('dataShow', function ($scope, $http) {
//$scope.gridheader = ['Name','City','Country']
$http.get('http://www.w3schools.com/website/Customers_MYSQL.php').success(function (data) {
$scope.MyRecCollection = data;
})
});
JSON Data :
[{
"Name": "Alfreds Futterkiste",
"City": "Berlin",
"Country": "Germany"
}, {
"Name": "Berglunds snabbköp",
"City": "Luleå",
"Country": "Sweden"
}, {
"Name": "Centro comercial Moctezuma",
"City": "México D.F.",
"Country": "Mexico"
}, {
"Name": "Ernst Handel",
"City": "Graz",
"Country": "Austria"
}, {
"Name": "FISSA Fabrica Inter. Salchichas S.A.",
"City": "Madrid",
"Country": "Spain"
}, {
"Name": "Galería del gastrónomo",
"City": "Barcelona",
"Country": "Spain"
}, {
"Name": "Island Trading",
"City": "Cowes",
"Country": "UK"
}, {
"Name": "Königlich Essen",
"City": "Brandenburg",
"Country": "Germany"
}, {
"Name": "Laughing Bacchus Wine Cellars",
"City": "Vancouver",
"Country": "Canada"
}, {
"Name": "Magazzini Alimentari Riuniti",
"City": "Bergamo",
"Country": "Italy"
}, {
"Name": "North/South",
"City": "London",
"Country": "UK"
}, {
"Name": "Paris spécialités",
"City": "Paris",
"Country": "France"
}, {
"Name": "Rattlesnake Canyon Grocery",
"City": "Albuquerque",
"Country": "USA"
}, {
"Name": "Simons bistro",
"City": "København",
"Country": "Denmark"
}, {
"Name": "The Big Cheese",
"City": "Portland",
"Country": "USA"
}, {
"Name": "Vaffeljernet",
"City": "Århus",
"Country": "Denmark"
}, {
"Name": "Wolski Zajazd",
"City": "Warszawa",
"Country": "Poland"
}]
There are many ways to display the json data in angular, you can bind your json as
ng-repeat
<tr ng-repeat="values in data">- nested ng-repeat depending on the json format
ng-repeat with 'track by' while dealing with index values
<tr ng-repeat="item in rows"> <td>{{item.project}}({{item.task}})</td> <td ng-repeat="values in item.hour track by $index"> <input type="number" ng-model="item.hour[$index]"/> </td> </tr>ng-repeat with key value pairs
<tr ng-repeat="(key, value) in data"> <td> {{key}} </td> <td> {{ value }} </td> </tr>
In your case, best option is to use basic ng-repeat as
<tr ng-repeat="values in data">
<td>{{values.keycolumn1}}</td>
<td>{{values.originkey1}}</td>
<td>{{values.datafield1}}</td>
</tr>
Just try like this,
var appReminder = angular.module('testApp', []);
appReminder.factory('testFactory', function ($http) {
return {}
});
appReminder.controller('testController', function PostController($scope, testFactory, $timeout)
{
$scope.result_function = function ()
{
$scope.respose = [
{"keycolumn1":1,"originkey1":1,"datafield1":1},
{"keycolumn1":2,"originkey1":2,"datafield1":2},
{"keycolumn1":3,"originkey1":3,"datafield1":3},
{"keycolumn1":4,"originkey1":4,"datafield1":4},
{"keycolumn1":5,"originkey1":5,"datafield1":5},
{"keycolumn1":11,"originkey1":11,"datafield1":11},
{"keycolumn1":12,"originkey1":12,"datafield1":12},
{"keycolumn1":13,"originkey1":13,"datafield1":13},
{"keycolumn1":14,"originkey1":14,"datafield1":14},
{"keycolumn1":15,"originkey1":15,"datafield1":15}];
;}
$scope.result_function();
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="testApp" data-ng-controller="testController">
<table border="1">
<tr>
<th>Keycolumn</th>
<th>Originkey</th>
<th>Datafield</th>
<tr>
<tr ng-repeat="item in respose">
<td>{{item.keycolumn1}}</td>
<td>{{item.originkey1}}</td>
<td>{{item.datafield1}}</td>
</tr>
</table>
</div>
You need a function to transform your data into an array so that it can be displayed on the template.
Write a function like this
transformData(rawData: any) {
let processedData: Array<Candle> = [];
Object.keys(rawData["Time Series (Daily)"] || []).forEach(key => {
processedData.push({
date: new Date(key),
open: rawData["Time Series (Daily)"][key]["1. open"],
high: rawData["Time Series (Daily)"][key]["2. high"],
low: rawData["Time Series (Daily)"][key]["3. low"],
close: rawData["Time Series (Daily)"][key]["4. close"],
volume: rawData["Time Series (Daily)"][key]["5. volume"]
});
});
return processedData;
}
and call it once the data is received from the service
something like
this.ativoData = this.transformData(this.rawData);
and in temple
<div class="container-analyzer">
<table>
<thead>
<th>Date</th>
<th>Open</th>
<th>High</th>
<th>Low</th>
<th>Close</th>
<th>Volume</th>
</thead>
<tbody *ngFor="let candle of ativoData">
<tr>
<td>{{candle.date | date}}</td>
<td>{{candle.open}}</td>
<td>{{candle.high}}</td>
<td>{{candle.low}}</td>
<td>{{candle.close}}</td>
<td>{{candle.volume}}</td>
</tr>
</tbody>
</table>
</div>
Here is a working sample
Instead of writing complex code you can use Mat-Angular ( material design components ) table ( https://material.angular.io/components/table/overview ) to construct your table. You can easily manipulate data that you want to show on the screen.
» npm install angular-json-table