diff options
| author | Misko Hevery | 2010-03-22 16:07:42 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-22 16:07:42 -0700 |
| commit | 6f8276a8e3735396999bd158005ca86bb1bb0978 (patch) | |
| tree | 23bc9ff28e335ef75bac8e7473861e41191625c7 /src/directives.js | |
| parent | d4ba33d075fea5e86963a9ff4982e433fc8c7968 (diff) | |
| download | angular.js-6f8276a8e3735396999bd158005ca86bb1bb0978.tar.bz2 | |
ng-watch directive
Diffstat (limited to 'src/directives.js')
| -rw-r--r-- | src/directives.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/directives.js b/src/directives.js index 861805fe..e081d179 100644 --- a/src/directives.js +++ b/src/directives.js @@ -82,6 +82,17 @@ angularDirective("ng-repeat", function(expression, element){ }; }, {exclusive: true}); +angularDirective("ng-watch", function(expression, element){ + var match = expression.match(/^([^.]*):(.*)$/); + if (!match) { + throw "Expecting watch expression 'ident_to_watch: watch_statement' got '" + + expression + "'"; + } + return function(){ + this.$watch(match[1], match[2]); + }; +}); + ///////////////////////////////////////// ///////////////////////////////////////// @@ -109,17 +120,6 @@ angularDirective("action", function(expression, element){ }; }); -//ng-watch -// <div ng-watch="$anchor.book: book=Book.get();"/> -angularDirective("watch", function(expression, element){ - var watches = { - 'lhs':'rhs' - }; // parse - return function(){ - this.$watch(watches); - }; -}); - //widget related //ng-validate, ng-required, ng-formatter //ng-error |
