From a5eb3ed107034cce5b7de3ec3f8a43ff3a379fa1 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 19 Jan 2011 00:10:39 -0800 Subject: $route should create child scope via $new --- src/services.js | 2 +- src/widgets.js | 11 ----------- test/widgetsSpec.js | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/services.js b/src/services.js index 0801ee9c..3543b2ea 100644 --- a/src/services.js +++ b/src/services.js @@ -708,7 +708,7 @@ angularServiceInject('$route', function(location) { if (!childScope) { var pathParams = matcher(location.hashPath, route); if (pathParams) { - childScope = createScope(parentScope); + childScope = parentScope.$new(); $route.current = extend({}, routeParams, { scope: childScope, params: extend({}, location.hashSearch, pathParams) diff --git a/src/widgets.js b/src/widgets.js index c1cb0c7b..3b0ffab7 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -625,20 +625,9 @@ angularWidget('ng:include', function(element){ return extend(function(xhr, element){ var scope = this, childScope; var changeCounter = 0; - var preventRecursion = false; function incrementChange(){ changeCounter++;} this.$watch(srcExp, incrementChange); this.$watch(scopeExp, incrementChange); - scope.$onEval(function(){ - if (childScope && !preventRecursion) { - preventRecursion = true; - try { - childScope.$eval(); - } finally { - preventRecursion = false; - } - } - }); this.$watch(function(){return changeCounter;}, function(){ var src = this.$eval(srcExp), useScope = this.$eval(scopeExp); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 59cbc3c6..48b9f8a1 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -651,7 +651,7 @@ describe("widget", function(){ // this one should really be just '1', but due to lack of real events things are not working // properly. see discussion at: http://is.gd/ighKk - expect(element.text()).toEqual('4'); + expect(element.text()).toEqual('2'); dealoc(element); }); -- cgit v1.2.3