-
Table in Backendless is bookingPista1
-
I share all code with all controller.js
.controller(‘novaReservaPista1Ctrl’, [’$scope’, ‘$stateParams’,’$ionicPopup’,
function ($scope, $stateParams, $ionicPopup) {
//Guardar reserves
function bookingPista1 () {
$scope.check = {selected: false}; //pel checkbox per consentir la reserva
if($scope.check.selected){
console.log($scope.user);
var reserva1 = new Backendless.reserva1;
reserva1.date = $scope.reserva1.date;
}else{
var alertPoup = $ionicPopup.alert({
title: ‘Error’,
template: ‘Has de acceptar les condicions previament.’
})
}
}
$scope.selectHour = function(event) {
//La variable EVENT és l’element clicat
var horaLliure = angular.element(event.target);
if(horaLliure.css(‘background-color’) == “green”) {
console.log (“1”)
//si esta en verd
horaLliure.css(‘background-color’, ‘red’);
}
else {
console.log (“entra”)
//Si no esta seleccionada, selecciona en verd
horaLliure.css(‘background-color’, ‘green’);
}
}
// A confirm dialog
function showConfirm () {
var confirmPopup = $ionicPopup.confirm({
title: ‘Reserva de pista 1’,
template: ‘Son correctes les dades de la reserva?’
});
confirmPopup.then(function(res) {
if(res) {
console.log(‘Si, estic segur’);
} else {
console.log(‘No, vui revisar-ho’);
}
});
};
//var savedReserva1 = Backendless.Persistence.of( ).save( reserva1 )
//Backendless.UserService.register( new Backendless.Async( bookingPista1, selectHour, showConfirm ) );
Backendless.Persistence.of(bookingPista1 ).save( new Backendless.Async( bookingPista1, showConfirm ) );
}])The problem is that not declare a reserva1? more or less like a $scope.reserva1 = {}
3. the applicatin id is 2BC692BA-F3D8-D573-FFCB-0D8999B3FB00 is declared in other js - apps.js
//Config Backendless
var APPLICATION_ID = ‘2BC692BA-F3D8-D573-FFCB-0D8999B3FB00’,
SECRET_KEY = ‘REMOVED BY MODERATOR’,
VERSION = ‘v1’; //default application version;
Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION);
I’m sorry but my skylls are few