Skip to content

Commit

Permalink
Integrated pull request ultimatecourses#32
Browse files Browse the repository at this point in the history
  • Loading branch information
szilarddavid committed May 8, 2018
1 parent a96cd2a commit 8ecabf7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@ultimate/ngxerrors",
"version": "0.0.0",
"name": "ngx-errors-complete",
"version": "4.1.1",
"description": "A declarative validation module for reactive forms",
"author": "Ultimate Angular",
"license": "MIT",
"repository": {
"url": "https://github.com/UltimateAngular/ngxerrors.git",
"url": "https://github.com/BitLoopTech/ngx-errors.git",
"type": "git"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/ngxerror.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class NgxErrorDirective implements OnInit, OnDestroy, DoCheck {
}

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

Expand Down
8 changes: 6 additions & 2 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,6 +71,10 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit {
}
}

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

ngOnChanges() {
this.control = this.form.control.get(this.controlName);
}
Expand All @@ -83,7 +87,7 @@ export class NgxErrorsDirective implements OnChanges, OnDestroy, AfterViewInit {
}

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

}

0 comments on commit 8ecabf7

Please sign in to comment.