fix(upgrade): allow deeper nesting of ng2 components/directives (#8949)

* fix(upgrade): add test for upgrade adapter bug

* fix(upgrade): allow deeper nesting of ng2 components/directives

allow a nesting sequence of ng2 > ng1 > ng2 directives
This commit is contained in:
Hannah Howard
2016-06-01 15:58:40 -07:00
committed by Miško Hevery
parent 21fc1bb655
commit 48bf349c3c
2 changed files with 42 additions and 2 deletions

View File

@ -547,8 +547,6 @@ function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function
function directiveFactory(ng1Injector: angular.IInjectorService,
componentFactoryRefMap: ComponentFactoryRefMap,
parse: angular.IParseService): angular.IDirective {
var componentFactory: ComponentFactory<any> = componentFactoryRefMap[info.selector];
if (!componentFactory) throw new Error('Expecting ComponentFactory for: ' + info.selector);
var idCount = 0;
return {
restrict: 'E',
@ -556,6 +554,9 @@ function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function
link: {
post: (scope: angular.IScope, element: angular.IAugmentedJQuery, attrs: angular.IAttributes,
parentInjector: any, transclude: angular.ITranscludeFunction): void => {
var componentFactory: ComponentFactory<any> = componentFactoryRefMap[info.selector];
if (!componentFactory) throw new Error('Expecting ComponentFactory for: ' + info.selector);
var domElement = <any>element[0];
if (parentInjector === null) {
parentInjector = ng1Injector.get(NG2_INJECTOR);