I am struggling to showcase information from a Firebase database with a multi-level key onto an HTML table using Angular.
Here is the structure of the data:
https://i.sstatic.net/qQ6RZ.jpg https://i.sstatic.net/PIaUZ.jpg
When attempting to display using ng-view
, the outcome looks like this:
My Controller:
.controller('SalesCtrl', ['$scope', '$firebaseArray', '$firebaseObject', function($scope, $firebaseArray, $firebaseObject) {
console.log('Sales Controller loaded..');
var ref = firebase.database().ref("pelanggan/sales01");
var list = $firebaseObject(ref);
list.$loaded().then(function() {
$scope.list = [];
angular.forEach(list, function(value,key){
$scope.list.push({ id: key, data: value})
});
});
I have experimented with different approaches like using ng-repeat
and ng-repeat-start.
However, I'm puzzled by why I am getting JSON format in my table.
My aim is to present the data in a format similar to the following:
-------------------------------------------------------------
| address | email | identity | service |
-------------------------------------------------------------
| jl.prapanca... | <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="423a3a02272f232b2e6c212d2f">[email protected]</a> | 12345 | xxxxxxxx |
-------------------------------------------------------------