In AngularJS,I open a modal by calling a service from controller:
controller:
$scope.openDialog = function (row) {
myService.showDialog(id, dataDate).result.then(function (flag) {
if (flag) {
//...
}
});
};
myService:
this.showDialog = function (id, selectdate) {
return wapPromptService.showDialog({
templateUrl: 'dialog.html'
controller: 'dialogCtrl',
windowClass: 'sendmargin',
size: 'lg',
resolve: {
loadModule: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load({
files: [
]
});
}],
id: function () {
return id;
},
selectdate: function () {
return selectdate;
},
}
});
};
I would like to hide the modal when I redirect to other page, and when I come back to page, the dialog is still there (shows there).
But I could only find the way to close or dismiss it like (inject $uibModalInstance
into dialogCtrl
):
$uibModalInstance.close(true)
or
$uibModalInstance.dismiss('cancel')
How can I hide and show it again with its previous state?
A similar question: