From a80a61839a66d244c8bb14bbe2975746e02516c8 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sat, 3 Apr 2010 17:04:36 -0700 Subject: injection is now working --- src/Compiler.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Compiler.js') diff --git a/src/Compiler.js b/src/Compiler.js index c9039928..dac4931f 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -1,5 +1,5 @@ /** - * Template provides directions an how to bind to a given element. += * Template provides directions an how to bind to a given element. * It contains a list of init functions which need to be called to * bind to a new instance of elements. It also provides a list * of child paths which contain child templates @@ -43,7 +43,7 @@ Template.prototype = { }, empty: function() { - return this.inits.length == 0 && this.paths.length == 0; + return this.inits.length === 0 && this.paths.length === 0; } }; @@ -63,8 +63,9 @@ Compiler.prototype = { var template = this.templatize(rawElement) || new Template(); return function(element, parentScope){ element = jqLite(element); - parentScope = parentScope || {}; - var scope = createScope(parentScope); + var scope = parentScope && parentScope.$eval ? + parentScope : + createScope(parentScope || {}, angularService); return extend(scope, { $element:element, $init: function() { @@ -161,7 +162,7 @@ function eachNode(element, fn){ function eachAttribute(element, fn){ var i, attrs = element[0].attributes || [], size = attrs.length, chld, attr, attrValue = {}; for (i = 0; i < size; i++) { - var attr = attrs[i]; + attr = attrs[i]; attrValue[attr.name] = attr.value; } foreach(attrValue, fn); -- cgit v1.2.3