mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
ng:view should be nestable in ng:include
This commit is contained in:
parent
bf7c9d9900
commit
fbc7f1b454
2 changed files with 21 additions and 1 deletions
|
|
@ -1074,7 +1074,8 @@ angularWidget('ng:view', function(element) {
|
|||
} else {
|
||||
element.html('');
|
||||
}
|
||||
});
|
||||
})(); //initialize the state forcefully, it's possible that we missed the initial
|
||||
//$route#onChange already
|
||||
|
||||
// note that this propagates eval to the current childScope, where childScope is dynamically
|
||||
// bound (via $route.onChange callback) to the current scope created by $route
|
||||
|
|
|
|||
|
|
@ -880,6 +880,25 @@ describe("widget", function(){
|
|||
rootScope.$eval();
|
||||
expect(rootScope.$element.text()).toEqual('new parent');
|
||||
});
|
||||
|
||||
it('should be possible to nest ng:view in ng:include', function() {
|
||||
dealoc(rootScope);
|
||||
rootScope = angular.compile('<div>include: <ng:include src="\'includePartial.html\'"></ng:include></div>');
|
||||
$browser = rootScope.$service('$browser');
|
||||
$browser.xhr.expectGET('includePartial.html').respond('view: <ng:view></ng:view>');
|
||||
$browser.setUrl('http://server/#/foo');
|
||||
|
||||
$route = rootScope.$service('$route');
|
||||
$route.when('/foo', {controller: angular.noop, template: 'viewPartial.html'});
|
||||
rootScope.$init();
|
||||
|
||||
$browser.xhr.expectGET('viewPartial.html').respond('content');
|
||||
$browser.xhr.flush();
|
||||
|
||||
expect(rootScope.$element.text()).toEqual('include: view: content');
|
||||
expect($route.current.template).toEqual('viewPartial.html');
|
||||
dealoc($route.current.scope);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue