1

I am trying to achieve stateful bootstrap modals using ui-router. I have followed the approach given in the Stackoverflow Solution for the same question

Though I am facing some issues as described below:

  1. When I click on browser's back button state is moving to parent state in URL but modal is not going off
  2. When I am moving from one modal to another (sibling modals), the previous modal is remaining as it is and new modal is getting open on top layer. So when I am closing second modal I can see the previous modal as it is. It should not be like that, modal should get off once you move to the another modal (whether to the child modal or sibling modal)

Can anyone help me for the same?

Community
  • 1
  • 1
PiyaModi
  • 213
  • 2
  • 9
  • 22

1 Answers1

0
  1. Use .run on state change, close all the modal on state change. Or listen back button even (I'm not sure). You should use HTML5 history replace api for reopened modal on back effect.

  2. Use setTimeout for closing/opening modal as per need. On next modal open first close existing opened modal then open new one. It should be handled by programmatically.

Nishchit
  • 18,284
  • 12
  • 54
  • 81
  • If he has access to modalInstance in controller, then he can call the dismiss() in $onDestroy() controller method. Or use onEnter / onExit method to handle uibModal – Disfigure Apr 11 '18 at 10:40