Skip to content

Commit 306718a

Browse files
author
Andrea Barbasso
committed
[UXP-126] changed deprecated factory method
1 parent d2ff262 commit 306718a

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/app/directives/text-select/text-select.directive.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {
22
ApplicationRef,
3-
ComponentFactoryResolver,
43
ComponentRef,
4+
createComponent,
55
Directive,
66
ElementRef,
77
EmbeddedViewRef,
8-
Injector,
8+
EnvironmentInjector,
99
Input,
1010
NgZone,
1111
OnDestroy,
@@ -48,8 +48,7 @@ export class TextSelectDirective implements OnInit, OnDestroy {
4848
private elementRef: ElementRef,
4949
private zone: NgZone,
5050
private appRef: ApplicationRef,
51-
private componentFactoryResolver: ComponentFactoryResolver,
52-
private injector: Injector
51+
private injector: EnvironmentInjector
5352
) {
5453
}
5554

@@ -120,10 +119,7 @@ export class TextSelectDirective implements OnInit, OnDestroy {
120119
this.zone.runGuarded(() => {
121120
this.hasSelection = true;
122121
if (this.componentRef === null) {
123-
const componentFactory =
124-
this.componentFactoryResolver.resolveComponentFactory(TextSelectionTooltipComponent);
125-
this.componentRef = componentFactory.create(this.injector);
126-
122+
this.componentRef = createComponent(TextSelectionTooltipComponent, {environmentInjector: this.injector});
127123
this.appRef.attachView(this.componentRef.hostView);
128124

129125
const domElem =

0 commit comments

Comments
 (0)