diff options
| author | Vojta Jina | 2010-10-30 20:57:13 +0200 | 
|---|---|---|
| committer | Igor Minar | 2010-11-07 14:42:03 -0800 | 
| commit | 00ca67e4befffed00ecee81bd1ce903fe01f542a (patch) | |
| tree | 4892661454572b97997b7a29499889c21a92a39d /src | |
| parent | 91b6c5f7ffaa19f967547ae3916641fed9e0f04c (diff) | |
| download | angular.js-00ca67e4befffed00ecee81bd1ce903fe01f542a.tar.bz2 | |
Issue #51: Update extensionMap()
If user override existing extension, angular properties ($) will be preserved.
This piece of logic could be refactored into separate method:
Something like we have extend(), addMissingProperties() - I can't find a name
for this method...
Closes #51
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js index dbd662ce..16b31d4b 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -281,11 +281,18 @@ function inherit(parent, extra) {  function noop() {}  function identity($) {return $;}  function valueFn(value) {return function(){ return value; };} +  function extensionMap(angular, name, transform) {    var extPoint;    return angular[name] || (extPoint = angular[name] = function (name, fn, prop){      name = (transform || identity)(name);      if (isDefined(fn)) { +      if (isDefined(extPoint[name])) { +        foreach(extPoint[name], function(property, key) { +          if (key.charAt(0) == '$' && isUndefined(fn[key])) +            fn[key] = property; +        }); +      }        extPoint[name] = extend(fn, prop || {});      }      return extPoint[name];  | 
