@shank93 wrote:
I am working on a project in Ionic and firebase. The issue is, when i try to update a data in my DB, the view of the app is getting switched to another. Tried lot of work around, but not yet fixed. In the gif we can see the view is changing from property view to list view behind the ionic modal. Is there any one faced this issue before or have solution please help me to get this done. Thank You.
Code for opening the modal and update database:
`$ionicModal.fromTemplateUrl('templates/contactinfopopup.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
$scope.ppointid="";
$scope.openModal = function(pid) {// Get a database reference to our posts $scope.userd=PeopleLoginService.getPeople(); var reflogn = new Firebase("https://pspacedb.firebaseio.com/Users/"+$scope.userd.$id); var authDatas = reflogn.getAuth(); if (authDatas) { reflogn.on("value", function(snapshot) { $scope.ppointid=snapshot.val().ppoint; $scope.ppointid=$scope.ppointid-1; }) if ($scope.ppointid>=1) { reflogn.update({ ppoint:$scope.ppointid}); // Get a database reference to our posts var ref = new Firebase("https://pspacedb.firebaseio.com/Developers/"+pid); $scope.prtyid=''; // Attach an asynchronous callback to read the data at our posts reference ref.on("value", function(snapshot) { $scope.prtyid=snapshot.val(); }) /*reflogn.update({ ppoint:$scope.ppointid});*/ $scope.modal.show(); } else { var alertPopup = $ionicPopup.alert({ title: 'No Enough Credits!', template: 'You can buy credits from our store.' }) } } else { var alertPopup = $ionicPopup.alert({ title: 'Not LoggedIn!', template: 'Please Login to Show Profile.' }) }
};`
HTML code:
<a class="tab-item" style="margin-top: 2.75%" type="button" ng-click="openinfoModal(properyid)"><i class="my-icon ion-information-circled"></i><p style="font-size: 13px">Unit Info</p></a>
Updating code:
reflogn.update({ ppoint:$scope.ppointid});
Posts: 1
Participants: 1