Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // save images
- const asyncArray = [];
- for (var _i in img_data) {
- var _meal_index = img_data[_i].meal_index;
- var _meal_image = img_data[_i].meal_image;
- asyncArray.push($scope._saveMealImageByAPI(_meal_index, _meal_image));
- }
- Promise.all(asyncArray)
- .then(
- function () {
- console.log(1);
- // images are saved
- $scope._saveProgressInfo.status = 'Сохранение завершено';
- $scope._saveProgressInfo.step = $scope._saveProgressInfo.steps;
- // Закрыть модалку
- $scope.$root.is_loading = false;
- $scope.$root.addAlert("Рацион успешно сохранен", "success", 5000);
- // TODO: verify
- },
- function () {
- $scope.$root.is_loading = false;
- $scope.$root.addAlert("Ошибка при сохранении изображений", "danger", 5000);
- }
- ).then(
- function () {
- console.log(2);
- console.log($scope.last_meal_save_data);
- $scope.getMealData();
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement