Being a complete novice in Angular, I am struggling to find the best solution to solve this particular issue. Let's say we have two users, 'A' and 'B', who owe money to each other.
User 'A' has 5 transactions and needs to pay $5000 to user 'B'. On the other hand, user 'B' has 50000 transactions and owes $100000 to 'A'. The current code displays 2 transactions instead of 1, requiring mental calculations. The code snippet is as follows:
$scope.charges = {};
totalChargeUserToFactory.query({
id: null
}).$promise.then(function (data) {
$scope.charges.to = data;
});
totalChargeUserFromFactory.query({
id: null
}).$promise.then(function (data) {
$scope.charges.from = data;
});
To address this issue, I made the following changes in my code:
$scope.charges = {};
totalChargeUserToFactory.query({
id: null
}).$promise.then(function (data) {
$scope.charges.to = data;
totalChargeUserFromFactory.query({
id: null
}).$promise.then(function (data) {
$scope.charges.from = data;
// Code for handling transactions between users A and B
});
});
However, a new problem arises - with a large number of transactions, it takes time for the content to load. User A may appear quickly on screen, but there is a delay of 2 seconds before user B shows up. This does not provide a good user experience. Can you suggest any tips or modifications based on this code snippet to improve performance?
I tried searching online for solutions, but couldn't find anything satisfactory that directly addresses my issue.