File tree 1 file changed +3
-7
lines changed
1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,17 @@ export class DomPortalHost extends BasePortalHost {
29
29
*/
30
30
attachComponentPortal < T > ( portal : ComponentPortal < T > ) : ComponentRef < T > {
31
31
let componentFactory = this . _componentFactoryResolver . resolveComponentFactory ( portal . component ) ;
32
- let componentRef : ComponentRef < T > ;
32
+ let componentRef = componentFactory . create ( portal . injector || this . _defaultInjector ) ;
33
+ //componentRef.hostView.detectChanges();
33
34
34
35
// If the portal specifies a ViewContainerRef, we will use that as the attachment point
35
36
// for the component (in terms of Angular's component tree, not rendering).
36
37
// When the ViewContainerRef is missing, we use the factory to create the component directly
37
38
// and then manually attach the view to the application.
38
39
if ( portal . viewContainerRef ) {
39
- componentRef = portal . viewContainerRef . createComponent (
40
- componentFactory ,
41
- portal . viewContainerRef . length ,
42
- portal . injector || portal . viewContainerRef . parentInjector ) ;
43
-
40
+ portal . viewContainerRef . insert ( componentRef . hostView ) ;
44
41
this . setDisposeFn ( ( ) => componentRef . destroy ( ) ) ;
45
42
} else {
46
- componentRef = componentFactory . create ( portal . injector || this . _defaultInjector ) ;
47
43
this . _appRef . attachView ( componentRef . hostView ) ;
48
44
this . setDisposeFn ( ( ) => {
49
45
this . _appRef . detachView ( componentRef . hostView ) ;
You can’t perform that action at this time.
0 commit comments