This repository has been archived by the owner on Feb 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.js
79 lines (71 loc) · 2.25 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function myFunction(){
url = "bookingPage.html";
window.open(url, "_self");
}
// Create AngularJS module and inject Firebase
angular.module('scheduleApp',['firebase'])
// Create main controller and get access to Firebase
.controller('mainController', function($scope, $firebaseObject){
// Connect to Firebase
var ref = new Firebase("https://scheduling-application-434.firebaseio.com/days");
//Sync as an object
var syncObject = $firebaseObject(ref);
// // Three-way data binding
syncObject.$bindTo($scope, 'days');
// Function to set default data
$scope.reset = function(){
ref.set({
day1: {
name: 'Monday',
slots: {
num1: {
time: '9:00 a.m.',
booked: false
},
num2: {
time: '11:00 a.m.',
booked: false
},
num3: {
time: '1:00 p.m.',
booked: false
}
}
},
day2: {
name: 'Tuesday',
slots: {
num1: {
time: '9:00 a.m.',
booked: false
},
num2: {
time: '11:00 a.m.',
booked: false
},
num3: {
time: '1:00 p.m.',
booked: false
}
}
},
day3: {
name: 'Wednesday',
slots: {
num1: {
time: '9:00 a.m.',
booked: false
},
num2: {
time: '11:00 a.m.',
booked: false
},
num3: {
time: '1:00 p.m.',
booked: false
}
}
}
});
};
});