When I use the following code, it works as expected:
$scope.firebase.car1.seats = index+1;
However, when I need for the car to be a variable, I'm not sure how to do this. I am correctly passing 'thecar' variable, but I'm not sure how to separate the code to make angularjs/javascript see that what I am supplying is a variable.
buttonClicked: function(index) {
firebase.$loaded().then(function() {
alert(thecar);
//this works
$scope.firebase.thecar.seats = index+1;
//this doesn't work, "cannot set property 'seats' of undefined".
});
}
$scope.firebase[thecar].seats
– Blackhole 21 hours ago