Whats the correct way to deal with arrays in firebase? I'm trying to toggle a value within an array or numbers when clicking a button. so each number exist only once, say button 12, is clicked, then 12 is added to the array in firebase, if clicked again then it's removed.
this is my code, however, it does not splice, the number is added again every time.
blockTime(time: number) {
const idx = _.indexOf(this.times, time);
if (idx >= 0) {
this.times.splice(idx, 1);
} else {
this.times.push(time);
}
}
timesis firebase array?${this.basePath}/${day}; this.times = this.db.list(dayPath); return this.times; }