I have this code in my controller
dashboardFactory.totalCustomer().then(function (response){
$scope.totalCustomer = response.data.count;
}, function (error) {
console.log(error);
});
dashboardFactory.totalPartner().then(function (response){
$scope.totalPartner = response.data.count;
}, function (error) {
console.log(error);
});
//below passed to html
$scope.charts = [{
color: pieColor,
description: 'Total Partner',
stats: $scope.totalPartner,
icon: 'person',
}, {
color: pieColor,
description: 'Jumlah Konsumen',
stats: $scope.totalCustomer,
icon: 'money',
}];
The above code result in empty, this is because $scope.charts created while promise not yet resolved?
How I can create array of object from promise result if every object have property which get from different promise factory method? so the rendered page is not empty.
The above example is 2 object, imagine if I have 10 or more object each object get from different promise factory method.
Any explanation appreciated as I'm new in angular.