I am using angular UI bootstrap and want to re-use the controller used in a modal dialog in a view that is not a dialog.
I tried to manually get the $modalInstance later via
$injector.get('$modalInstance')
, but this does not work ( $injector.has('$modalInstance')
equals false
)
It only works when I directly inject it via
angular.module('mymodule').controller('MyModalCtrl', function($modalInstance) {
// do something with $modalInstance
});
Is there a way to re-use the controller-code or do I have to write two separate controllers?