g00fy- / angular-datepicker

calendar and datepicker directives for angular
MIT License
722 stars 421 forks source link

Updating Calendar on input change #322

Open jonnycraze opened 7 years ago

jonnycraze commented 7 years ago

I apologize if this is addressed somewhere else, I just haven't found a clear answer one way or the other.

If I focus on an input with the date-time attribute, and update the value in the input field, is there a way to have that update the Calendar UI as well? I'm not seeing it in current examples but wondering if there is a way to do it.

Thanks much

DanTalash commented 7 years ago

If I understood you correctly, you want to have both an input element and a div element using the same date, and if one is updated then the other should automatically update?

The only real thing you need to do is set all elements to use the same object, and set the watch-direct-changes="true" attribute on the div elements. See this plunkr for an example.

mbaumrucker commented 7 years ago

I'm having the same issue as @jonnycraze .

When updating the input manually my model doesn't get updated. The fix @DanTalash suggests is not what I'm looking for, I don't have 2 calendars, just 1 where I want to be able to let the user edit the date from the input itself.

Another option is to disable direct input, but I can't find a solution for that.

dsvictorh commented 7 years ago

+1

payros commented 6 years ago

+1

philippone commented 6 years ago

+1

ArgV04 commented 6 years ago

Another option is to disable direct input, but I can't find a solution for that.

Simply make the input field readonly to disable direct input flow