diff --git a/lib/core_dom/block_factory.dart b/lib/core_dom/block_factory.dart index ba006da4e..982f804ed 100644 --- a/lib/core_dom/block_factory.dart +++ b/lib/core_dom/block_factory.dart @@ -120,7 +120,7 @@ class BlockFactory { NgAnnotation annotation = ref.annotation; var visibility = _elementOnly; if (ref.annotation is NgController) { - scope = scope.createChild({}); + scope = scope.createChild(new PrototypeMap(scope.context)); nodeModule.value(Scope, scope); } if (ref.annotation.visibility == NgDirective.CHILDREN_VISIBILITY) { diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index 7fe0b8a9b..53c8c5805 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -19,7 +19,9 @@ main() => describe('dte.compiler', () { ..type(LocalAttrDirective) ..type(OneOfTwoDirectives) ..type(TwoOfTwoDirectives) - ..type(MyController); + ..type(MyController) + ..type(MyParentController) + ..type(MyChildController); return (Injector _injector) { injector = _injector; $compile = injector.get(Compiler); @@ -541,6 +543,17 @@ main() => describe('dte.compiler', () { rootScope.apply(); expect(log.result()).toEqual('IncludeTransclude; SimpleTransclude'); }))); + + it('should expose a parent controller to the scope of its children', inject((TestBed _) { + + var element = _.compile('