I am currently utilizing Ionic Framework version 1.7.16
The error on Android is pinpointed to the following line of code
var obj = {[$myid] : firebase.database.ServerValue.TIMESTAMP};
No error occurs when the line above is changed to the following
var obj = {'test':'test'};
Controller Code:
.controller('SearchStateCtrl', function($scope, $firebaseObject, $firebaseArray, $location, $stateParams, my_details) {
$scope.stateId = $stateParams.stateId;
$scope.my_details = my_details;
var user = firebase.auth().currentUser;
$scope.my_id = user.uid;
var database = firebase.database();
var trips = database.ref('Trips/'+$stateParams.stateId);
trips.on('value', function(snapshot) {
$scope.my_trips = $firebaseArray(trips);
}, function(err) {
console.log("Something is wrong.");
});
$scope.addToMyTrip = function ($trip, $myid) {
var tripRef = database.ref('MyTrips');
var obj = {[$myid] : firebase.database.ServerValue.TIMESTAMP};
tripRef.set(obj).catch(function(error) {
console.log('Somthing went wrong.');
});
var tripRef = database.ref('MyTrips/'+$trip.$id);
tripRef.set({
'i-am': $trip['i-am'],
'trip-date': $trip['trip-date'],
'state-from': $trip['state-from'],
'city-from': $trip['city-from'],
'state-to': $trip['state-to'],
'city-to': $trip['city-to'],
'user-id': $trip['user-id']
}).catch(function(error) {
console.log('Somthing went wrong.');
});
}
})
The error on Android seems to be caused by the dynamic key name, as everything works without any issues when viewed on the webpage using
ionic serve --lab