plunk: <http://plnkr.co/edit/85Wl5W> If I use the $modalInstance on the same controller(modalController.js), without being in a modal, angular gets frozen. 

I just want to simplify my life using angularjs with the angular-ui bootstrap modal service. I want to use the same controller on a separate file, but on a modal as well. That is, I want them to do the same task. Is there any proper way to do it? 

E.g. modal.html, modalController.js. I want to show these on a modal window, but on my application as well without a modal. The issue is that if I use the same controller I can't inject the $modalInstance, as it's undefined if there's no modal. 

Thanks in advance,

Alex