I\'ve got an app defined this way:
angular.module(\"myApp\", [...])
.config(function ($stateProvider, $controllerProvider) {
if (isControllerDefined(co
Since angular 1.5.1
(not released yet at the time of writing), there is a new way to check whether a controller exists or not through the $ControllerProvider.has('MyCtrlName')
method.
Github issue: https://github.com/angular/angular.js/issues/13951
Github PR: https://github.com/angular/angular.js/pull/14109
Commit backported in 1.5.1 directly: https://github.com/angular/angular.js/commit/bb9575dbd3428176216355df7b2933d2a72783cd
Disclaimer: Since many people were interested by this feature, I made a PR, because I also need it is some of my projects. Have fun! :)
This PR has been based on @trekforever answer, thanks for the hint :)