How to check if an angularjs controller has been defined

后端 未结 5 1614
被撕碎了的回忆
被撕碎了的回忆 2021-01-17 20:35

I\'ve got an app defined this way:

angular.module(\"myApp\", [...])
  .config(function ($stateProvider, $controllerProvider) {
    if (isControllerDefined(co         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-17 20:47

    You could use the $controller service and do $controller('myController') and wrap a try-catch arround it so you know if it fails.

提交回复
热议问题