Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ dist

# Docs
gh-pages

# VScode stop adding .angulardoc.json
.angulardoc.json
3 changes: 2 additions & 1 deletion src/ngxerror.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class NgxErrorDirective implements OnInit, OnDestroy, DoCheck {
}

ngOnDestroy() {
this._states.complete();
this.subscription.unsubscribe();
}

}
}
12 changes: 8 additions & 4 deletions src/ngxerrors.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit {
@Input('ngxErrors')
controlName: string;

subject = new BehaviorSubject<ErrorDetails>(null);
subject: BehaviorSubject<ErrorDetails>;

control: AbstractControl;

Expand Down Expand Up @@ -71,10 +71,14 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit {
}
}

ngOnInit() {
this.subject = new BehaviorSubject<ErrorDetails>(null);
}

ngOnChanges() {
this.control = this.form.control.get(this.controlName);
}

ngAfterViewInit() {
setTimeout(() => {
this.checkStatus();
Expand All @@ -83,7 +87,7 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit {
}

ngOnDestroy() {
this.subject.unsubscribe();
this.subject.complete();
}

}
}