|
@@ -11,6 +11,7 @@ app.controller('SelectMenuPageController',['$scope','$firebaseObject','$timeout'
|
|
|
var keys = Object.keys($scope.meals);
|
|
|
$scope.meals[keys[i]].isSelected = true;
|
|
|
ref.child(keys[i]).set($scope.meals[keys[i]]);
|
|
|
+ //console.log($scope.meals[keys[i]])
|
|
|
}
|
|
|
ref.on('value', snap => {
|
|
|
// var databaseT0ests = [];
|
|
@@ -39,4 +40,28 @@ app.controller('SelectMenuPageController',['$scope','$firebaseObject','$timeout'
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ // Andrii code start
|
|
|
+
|
|
|
+ $scope.deleteMeal = function(i){
|
|
|
+ var keys = Object.keys($scope.meals);
|
|
|
+ $scope.meals[keys[i]].isSelected = false;
|
|
|
+ ref.child(keys[i]).set($scope.meals[keys[i]]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ // Нужно написать функцию которая будет обнолять все isSelected на false при запуске приложения
|
|
|
+
|
|
|
+ $scope.reloadItems = function(){
|
|
|
+ var keys = Object.keys($scope.meals);
|
|
|
+ for(var i =0; i<$scope.meals.length; i++) {
|
|
|
+ $scope.meals[keys[i]].isSelected = false;
|
|
|
+ ref.child(keys[i]).set($scope.meals[keys[i]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ */
|
|
|
+
|
|
|
+// Andrii code end
|
|
|
+
|
|
|
}])
|