diff options
| author | Misko Hevery | 2010-03-22 13:58:04 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-22 13:58:04 -0700 |
| commit | 84552f7f8ac3f39c4dbd7d946ae2938d63302840 (patch) | |
| tree | d3a4433d12bcbfb9d42f92a7b8ec12762ae7df3a /src/directivesAngularCom.js | |
| parent | f6664ed7f6f6dd1f4f9756f57611a316089149cb (diff) | |
| download | angular.js-84552f7f8ac3f39c4dbd7d946ae2938d63302840.tar.bz2 | |
got few directives working
Diffstat (limited to 'src/directivesAngularCom.js')
| -rw-r--r-- | src/directivesAngularCom.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/directivesAngularCom.js b/src/directivesAngularCom.js new file mode 100644 index 00000000..84032bdd --- /dev/null +++ b/src/directivesAngularCom.js @@ -0,0 +1,29 @@ + +angular.directive("auth", function(expression, element){ + return function(){ + if(expression == "eager") { + this.$users.fetchCurrent(); + } + }; +}); + + +//expression = "book=Book:{year=2000}" +angular.directive("entity", function(expression, element){ + //parse expression, ignore element + var entityName; // "Book"; + var instanceName; // "book"; + var defaults; // {year: 2000}; + + parse(expression); + + return function(){ + this[entityName] = this.$datastore.entity(entityName, defaults); + this[instanceName] = this[entityName](); + this.$watch("$anchor."+instanceName, function(newAnchor){ + this[instanceName] = this[entityName].get(this.$anchor[instanceName]); + }); + }; +}); + + |
