Answer the question
In order to leave comments, you need to log in
Why is the function being executed twice?
EventService.getDataFromDB().then(function(result) {
if (result.length > 0) {
$scope.items = EventService.populateData(result).items
$scope.categories = EventService.populateData(result).categories
console.log('Готово (база)!');
} else {
EventService.getDataFromApi().then(function() {
EventService.getDataFromDB().then(function(result) {
$scope.items = EventService.populateData(result).items
$scope.categories = EventService.populateData(result).categories
console.log('Готово (API)!');
})
})
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question