I have two states in ui-router. A main state and a modal state. main state shows a page and is dynamic based on pageCode. modal state opens a dialog using mdDialog and it's content is dynamic too. the content is another page, that can also be opened in main state in situations. when a modal is opened, the content can also link to another page, which needs to open again in a new modal(modal in modal), which I use a global service to handle all modals.
Now the issue is when the second modal opens, since they use the same state and state parameters, the first opened modal content will also change. Is there a way to prevent this or maybe a better design approach?
Plunkr to show the issue: http://next.plnkr.co/edit/4PbnZ778Utdb27PX When you click the open second dialog button inside the first dialog, see that the test1 in the first dialog changes to test2 right before dialog 2 opens