mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-22 09:30:28 +00:00
fix for ng:include does not remove partial if src goes to undefined
This commit is contained in:
parent
59401b80ee
commit
0df7329a6a
2 changed files with 17 additions and 0 deletions
|
|
@ -260,6 +260,8 @@ angularWidget('ng:include', function(element){
|
|||
compiler.compile(element)(element, childScope);
|
||||
childScope.$init();
|
||||
});
|
||||
} else {
|
||||
element.html('');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -436,6 +436,21 @@ describe("widget", function(){
|
|||
scope.$init();
|
||||
expect(element.text()).toEqual('misko');
|
||||
});
|
||||
|
||||
it('should remove previously included text if a falsy value is bound to src', function() {
|
||||
var element = jqLite('<ng:include src="url" scope="childScope"></ng:include>');
|
||||
var scope = angular.compile(element);
|
||||
scope.childScope = createScope();
|
||||
scope.childScope.name = 'igor';
|
||||
scope.url = 'myUrl';
|
||||
scope.$xhr.cache.data.myUrl = {value:'{{name}}'};
|
||||
scope.$init();
|
||||
|
||||
scope.url = undefined;
|
||||
scope.$eval();
|
||||
|
||||
expect(element.text()).toEqual('');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue