问题描述
我无法删除/移除模态。当模态出现时,当计数等于 0
时发生倒计时,我希望删除模态。一切正常,直到计数为 0
。但是一旦计数为 0
,模态关闭并重新启动计数器。
$scope.showModal = function () {
if ($scope.ctmodal) {
$scope.ctmodal.show();
} else {
$ionicModal.fromTemplateUrl('templates/ctmodal.html',{
scope: $scope,animation: 'slide-in-up'
}).then(function (modal) {
$scope.ctmodal = modal;
modal.show();
});
}
startTimer();
};
function startTimer() {
// stop if any interval is running
stop();
$scope.interval = $interval(function(){
// .........a function to start countdown..
// when count reaches 0 remove modal. ...........
if ($scope.count === 0) {
dismissModal();
}
},1000);
}
function stop() {
$interval.cancel($scope.interval);
}
$scope.$on('$destroy',function() {
stop();
});
function dismissModal() {
stop();
$scope.ctmodal.remove();
delete $scope.ctmodal;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)