aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng')
-rw-r--r--src/ng/compile.js9
-rw-r--r--src/ng/directive/ngView.js2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index 18adc2c9..2ed34f73 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -330,7 +330,14 @@ function $CompileProvider($provide) {
var $linkNode = cloneConnectFn
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
: $compileNodes;
- $linkNode.data('$scope', scope);
+
+ // Attach scope only to non-text nodes.
+ for(var i = 0, ii = $linkNode.length; i<ii; i++) {
+ var node = $linkNode[i];
+ if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
+ $linkNode.eq(i).data('$scope', scope);
+ }
+ }
safeAddClass($linkNode, 'ng-scope');
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
diff --git a/src/ng/directive/ngView.js b/src/ng/directive/ngView.js
index 2fd3a600..6e92c2d8 100644
--- a/src/ng/directive/ngView.js
+++ b/src/ng/directive/ngView.js
@@ -147,7 +147,7 @@ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c
if (current.controller) {
locals.$scope = lastScope;
controller = $controller(current.controller, locals);
- element.contents().data('$ngControllerController', controller);
+ element.children().data('$ngControllerController', controller);
}
link(lastScope);