diff options
| author | Misko Hevery | 2011-11-17 12:49:15 -0800 |
|---|---|---|
| committer | Igor Minar | 2011-11-30 14:49:36 -0500 |
| commit | 0e1fa2aefe34fe9ba5c957efde9ae4a82df54e11 (patch) | |
| tree | 88463996139a1f8433802e49c35d6b649fafb7f4 /src/directives.js | |
| parent | 3d0ce0ebe9ce26f54ce0527ece7a7950bc2e8368 (diff) | |
| download | angular.js-0e1fa2aefe34fe9ba5c957efde9ae4a82df54e11.tar.bz2 | |
feat($interpolate): string interpolation function
Diffstat (limited to 'src/directives.js')
| -rw-r--r-- | src/directives.js | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/directives.js b/src/directives.js index 41fbac16..ea09fc06 100644 --- a/src/directives.js +++ b/src/directives.js @@ -282,45 +282,6 @@ angularDirective("ng:bind", function(expression, element){ }]; }); -var bindTemplateCache = {}; -function compileBindTemplate(template){ - var fn = bindTemplateCache[template]; - if (!fn) { - var bindings = []; - forEach(parseBindings(template), function(text){ - var exp = binding(text); - bindings.push(exp - ? function(scope, element) { return scope.$eval(exp); } - : function() { return text; }); - }); - bindTemplateCache[template] = fn = function(scope, element, prettyPrintJson) { - var parts = [], - hadOwnElement = scope.hasOwnProperty('$element'), - oldElement = scope.$element; - - // TODO(misko): get rid of $element - scope.$element = element; - try { - for (var i = 0; i < bindings.length; i++) { - var value = bindings[i](scope, element); - if (isElement(value)) - value = ''; - else if (isObject(value)) - value = toJson(value, prettyPrintJson); - parts.push(value); - } - return parts.join(''); - } finally { - if (hadOwnElement) { - scope.$element = oldElement; - } else { - delete scope.$element; - } - } - }; - } - return fn; -} /** * @ngdoc directive |
