Skip to content

Commit

Permalink
Merge pull request #121 from Ludevik/master
Browse files Browse the repository at this point in the history
fix: validate control when options change
  • Loading branch information
kekeh authored Jan 8, 2018
2 parents 3327672 + 21f5e31 commit 3b824c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mydatepicker",
"version": "2.4.1",
"version": "2.4.2",
"description": "Angular date picker",
"keywords": [
"Angular",
Expand Down
3 changes: 2 additions & 1 deletion src/ngx-my-date-picker/ngx-my-date-picker.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class NgxMyDatePickerDirective implements OnChanges, ControlValueAccessor
if (this.opts.maxYear > Year.max) {
this.opts.maxYear = Year.max;
}
this.validate(undefined);
}

public writeValue(value: any): void {
Expand Down Expand Up @@ -268,9 +269,9 @@ export class NgxMyDatePickerDirective implements OnChanges, ControlValueAccessor
}

private updateModel(model: IMyDateModel): void {
this.setInputValue(model.formatted);
this.onChangeCb(model);
this.onTouchedCb();
this.setInputValue(model.formatted);
}

private setInputValue(value: string): void {
Expand Down

0 comments on commit 3b824c6

Please sign in to comment.