diff options
| author | Igor Minar | 2011-02-04 13:29:45 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-02-04 14:11:53 -0800 | 
| commit | fbc7f1b4545f7ed9376ef3abe9b5fbb3cb43dc43 (patch) | |
| tree | 908c6b7b32b9673d0f1326c2cb007063467517a7 | |
| parent | bf7c9d9900ba78a2c881caacc4be9ab43469663e (diff) | |
| download | angular.js-fbc7f1b4545f7ed9376ef3abe9b5fbb3cb43dc43.tar.bz2 | |
ng:view should be nestable in ng:include
| -rw-r--r-- | src/widgets.js | 3 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 19 | 
2 files changed, 21 insertions, 1 deletions
| diff --git a/src/widgets.js b/src/widgets.js index ea76cfc2..6482f455 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -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 diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 6bff5a36..12fe7b64 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -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); +    });    });  }); | 
