Skip to content

Commit 7775115

Browse files
committed
core(controller.has): Add a public "has" method to the Controller class, to check the existence of a given controller.
1 parent 85ef70f commit 7775115

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/ng/controller.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ function $ControllerProvider() {
2727
var controllers = {},
2828
globals = false;
2929

30+
/**
31+
* @ngdoc method
32+
* @name $controllerProvider#has
33+
* @param (string) name Controller name to check.
34+
*/
35+
this.has = function(name){
36+
return (name && controllers[name])? true : false;
37+
};
38+
3039
/**
3140
* @ngdoc method
3241
* @name $controllerProvider#register

0 commit comments

Comments
 (0)