Get module and controller|service|directive names at runtime Get module and controller|service|directive names at runtime angularjs angularjs

Get module and controller|service|directive names at runtime


There was a similar question that I found on SO, but the solution works only when using controller as syntax.

// a simple route with controller as syntax$routeProvider.when(    '/myRoute',     {         templateUrl: '/myRoute',         controller: 'ControllerOne as vm'     });// controllerapp.controller("ControllerOne", ['$log', function ControllerOne($log) {    var vm = this;    $log.log(vm.constructor.name); }]);