Closed mickeychu closed 7 years ago
It's already 2.0 ready. README.md install instruction does not work with 2.0?
It works, but it caused this warning:
Besides, it made my form always Dirty from the beginning, even I have set it to Pristine.
If I removed the datetime-picker
directive, no warning and the form become pristine as normal when the page first loaded.
here's the HTML
<input type="text" formControlName="deadlineDate" [(ngModel)]="myForm.value.deadlineDate" ng2-datetime-picker close-on-select="false" date-only="true" (blur)="myForm.markAsDirty()">
PS: I'm using Angular 2.0.1
Thanks for reporting this. I will treat as bug.
@Krisa can you look into this issue?
@mickeychu - the latest PR shall have resolved that.
But you should remove blur
and ngModel
because I think there is some conflicts here.
<input type="text" formControlName="deadlineDate" ng2-datetime-picker close-on-select="false" date-only="true">
@allenhwkim I think the Readme is slightly outdated too in this regard (it references both ngModel and formControl)
https://plnkr.co/edit/su2aiL?p=preview
I have tested this plunker without ngModel, but it seems never makes the form dirty by selecting a date. With ngModel, it makes form dirty initially. In either case, it's not desirable behaviour, I think.
This works when clicking on a link, but selecting a date is not triggering the markAsDirty method ... will check later today
thanks @Krisa
there is something weird with all these messages. but the PR looks normal.
I've updated the package to latest release 0.9.5. Removed the ngModel. The form is not Dirty when the page first loaded.
However, when I change the date and submit the form, the value of the date does not change at all. (though it does change the date displayed on the input)
Tested it with :
this.myForm.controls['start_date'].valueChanges.subscribe(data => {
console.log(data);
});
Nothing happened.
Yes, the package has not been updated on Npm yet. Can you try with the github version instead?
Oh yes, it works perfect now. Thank you @Krisa . Will you update the npm package soon?
@allenhwkim is the Npm master!
This should be on npm. 0.9.6 matches to the current github master branch.
How to make this work with Angular 2 final (2.0.1) ? thank you!