aboutsummaryrefslogtreecommitdiffstats
path: root/src/directives.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/directives.js')
-rw-r--r--src/directives.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/directives.js b/src/directives.js
index 4f2916da..d1b1dba3 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -4,6 +4,17 @@ angularDirective("ng-init", function(expression){
};
});
+angularDirective("ng-controller", function(expression){
+ return function(element){
+ var controller = getter(window, expression, true) || getter(this, expression, true);
+ if (!controller)
+ throw "Can not find '"+expression+"' controller.";
+ if (!isFunction(controller))
+ throw "Reference '"+expression+"' is not a class.";
+ this.$become(controller);
+ };
+});
+
angularDirective("ng-eval", function(expression){
return function(element){
this.$onEval(expression, element);