mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-24 02:10:24 +00:00
Revert "fix ng:include issue introduced by a5eb3ed1"
This reverts commit17ee0f031a. this anda5eb3ed1introduced scope leakage that can't be resolved until we fix up scope relationships and eval propagation. I'm reverting both this anda5eb3ed1until we can properly address the issue.
This commit is contained in:
parent
5340d1e0b1
commit
567f33823b
2 changed files with 2 additions and 24 deletions
|
|
@ -635,12 +635,7 @@ angularWidget('ng:include', function(element){
|
|||
if (src) {
|
||||
xhr('GET', src, function(code, response){
|
||||
element.html(response);
|
||||
if (useScope) {
|
||||
childScope = useScope;
|
||||
} else {
|
||||
childScope = createScope(scope);
|
||||
scope.$onEval(childScope.$eval);
|
||||
}
|
||||
childScope = useScope || createScope(scope);
|
||||
compiler.compile(element)(element, childScope);
|
||||
childScope.$init();
|
||||
scope.$eval(onloadExp);
|
||||
|
|
|
|||
|
|
@ -609,24 +609,7 @@ describe("widget", function(){
|
|||
});
|
||||
|
||||
describe('ng:include', function(){
|
||||
it('should include on external file and create a new child scope', function() {
|
||||
var element = jqLite('<ng:include src="url"></ng:include>');
|
||||
var scope = angular.compile(element);
|
||||
scope.counter = 0;
|
||||
scope.url = 'myUrl';
|
||||
scope.$service('$xhr.cache').data.myUrl = {value:'{{counter = counter + 1}}'};
|
||||
scope.$init();
|
||||
scope.$service('$browser').defer.flush();
|
||||
expect(element.text()).toEqual('2');
|
||||
|
||||
//should also propagate evals to the child scope
|
||||
scope.$eval();
|
||||
expect(element.text()).toEqual('3');
|
||||
|
||||
dealoc(scope);
|
||||
});
|
||||
|
||||
it('should include on external file and use an existing child scope', function() {
|
||||
it('should include on external file', function() {
|
||||
var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
|
||||
var scope = angular.compile(element);
|
||||
scope.childScope = createScope();
|
||||
|
|
|
|||
Loading…
Reference in a new issue