mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-23 09:50:24 +00:00
Revert "$route should create child scope via $new"
This reverts commit a5eb3ed107.
See 9ca2facb for reasoning.
This commit is contained in:
parent
567f33823b
commit
8d507df8c9
3 changed files with 13 additions and 2 deletions
|
|
@ -708,7 +708,7 @@ angularServiceInject('$route', function(location) {
|
|||
if (!childScope) {
|
||||
var pathParams = matcher(location.hashPath, route);
|
||||
if (pathParams) {
|
||||
childScope = parentScope.$new();
|
||||
childScope = createScope(parentScope);
|
||||
$route.current = extend({}, routeParams, {
|
||||
scope: childScope,
|
||||
params: extend({}, location.hashSearch, pathParams)
|
||||
|
|
|
|||
|
|
@ -625,9 +625,20 @@ 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);
|
||||
|
|
|
|||
|
|
@ -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('2');
|
||||
expect(element.text()).toEqual('4');
|
||||
dealoc(element);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue