We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to close spModal when switching from one modal to another?

g_eggidio
Kilo Contributor

Hi guys,
I need to close an open spmodal when I switch to a new modal opened by the latter.

What is the best way to do it?

I opened a modal via spmodal.open() in the client-side controller.

Thanks, Giovanni

 

5 REPLIES 5

JonathanJacob
Mega Sage

In case anyone else is facing this issue and doesn't want to use $uibModal. You can inject "$uibModalStack" into your client controller (since spModal wraps it).

Client Script/Controller:

function($scope, spModal, $uibModalStack) {

/* widget controller */
  var c = this;




}

 

Then call when you want to close it... Note: this will close all open modals in the stack.

$uibModalStack.dismissAll();