diff --git a/.gitignore b/.gitignore index 1cb2771..39d9281 100755 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ dist # Docs gh-pages + +# VScode stop adding .angulardoc.json +.angulardoc.json diff --git a/src/ngxerror.directive.ts b/src/ngxerror.directive.ts index 6b5ae7d..ad2e631 100755 --- a/src/ngxerror.directive.ts +++ b/src/ngxerror.directive.ts @@ -70,7 +70,8 @@ export class NgxErrorDirective implements OnInit, OnDestroy, DoCheck { } ngOnDestroy() { + this._states.complete(); this.subscription.unsubscribe(); } -} \ No newline at end of file +} diff --git a/src/ngxerrors.directive.ts b/src/ngxerrors.directive.ts index e0b74da..68fe741 100755 --- a/src/ngxerrors.directive.ts +++ b/src/ngxerrors.directive.ts @@ -16,7 +16,7 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit { @Input('ngxErrors') controlName: string; - subject = new BehaviorSubject(null); + subject: BehaviorSubject; control: AbstractControl; @@ -71,10 +71,14 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit { } } + ngOnInit() { + this.subject = new BehaviorSubject(null); + } + ngOnChanges() { this.control = this.form.control.get(this.controlName); } - + ngAfterViewInit() { setTimeout(() => { this.checkStatus(); @@ -83,7 +87,7 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit { } ngOnDestroy() { - this.subject.unsubscribe(); + this.subject.complete(); } -} \ No newline at end of file +}