diff options
| author | Misko Hevery | 2010-04-05 21:26:52 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-04-05 21:26:52 -0700 | 
| commit | e6460685869e16b5016de975fd0ba15a7e436951 (patch) | |
| tree | bdf55503a5efd7e1922b73ab8ea0ac23c4137cf9 /src/directives.js | |
| parent | 2107eafcde390eebbf59e829194626c488de9e29 (diff) | |
| download | angular.js-e6460685869e16b5016de975fd0ba15a7e436951.tar.bz2 | |
added ng-controller directive
Diffstat (limited to 'src/directives.js')
| -rw-r--r-- | src/directives.js | 11 | 
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);  | 
