Skip to content

Commit

Permalink
Merge pull request #98 from ngneat/fix/remove-component-factory
Browse files Browse the repository at this point in the history
remove component factory usage
  • Loading branch information
shaharkazaz committed Dec 29, 2022
2 parents 1ec93f0 + 2813623 commit 28486f6
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ComponentFactoryResolver,
ComponentRef,
Directive,
ElementRef,
Expand Down Expand Up @@ -51,7 +50,6 @@ export class ControlErrorsDirective implements OnInit, OnDestroy {

constructor(
private vcr: ViewContainerRef,
private resolver: ComponentFactoryResolver,
private host: ElementRef,
@Inject(ErrorTailorConfigProvider) private config: ErrorTailorConfig,
@Inject(FORM_ERRORS) private globalErrors,
Expand Down Expand Up @@ -123,10 +121,7 @@ export class ControlErrorsDirective implements OnInit, OnDestroy {

private setError(text: string, error?: ValidationErrors) {
if (!this.ref) {
const factory = this.resolver.resolveComponentFactory<ControlErrorComponent>(
this.mergedConfig.controlErrorComponent
);
this.ref = this.anchor.createComponent<ControlErrorComponent>(factory);
this.ref = this.anchor.createComponent<ControlErrorComponent>(this.mergedConfig.controlErrorComponent);
}
const instance = this.ref.instance;

Expand Down

0 comments on commit 28486f6

Please sign in to comment.