My code currently has the following variable :
var ref = firebase.database.ref("players").child("week1");
$scope.players = ref;
But what I want to do is change the ref based on a particular date.
This is what I have tried:
var d = new Date();
var n = d.getDay();
var q = d.getDate();
if (n ===4 && q ===3) {
var ref = var ref = firebase.database.ref("players").child("week1");
} if (n === 4 && q === 5){
var ref = firebase.database.ref("players").child("week2");
}
But the code does not work. Is there a way to change the database node that is queried based on the date via an if statement?
Aucun commentaire:
Enregistrer un commentaire