I am using AngularJS, ionic1. I have some functionality in my app which runs after certain time and shows a success popup. I am using $ionicPopup.alert for this.
When close popup after certain time it is perfectly working fine, but it removes popup styles when it is shown next time.
Here is my test code:
$ionicPopup.alert({
title: 'Operation Successful',
template: 'operation has been completed'
});
$rootScope.promise_closePopup;
$rootScope.promise_closePopup = $interval($rootScope.closePopup, 9000);
and for closing popup:
$rootScope.closePopup = function () {
var popuplist = $ionicPopup._popupStack;
if (popuplist.length > 0) {
popuplist.forEach(function (popup, index) {
popup.remove();
popuplist.pop();
});
$ionicBackdrop.release();
$ionicBody.removeClass('popup-open');
$interval.cancel($rootScope.promise_closePopup);
}
};