Adds parameter disableClick to allow for typing in the datetimefield #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added a new parameter disableClick that allows the user to type in the datefield, instead of opening the datetimepicker once the field gets focus. This is best used in combination with a button that opens the datetimepicker. This mimics the way the md-datepicker works by default. See https://material.angularjs.org/latest/demo/datepicker
The input the user types in the field needs to conform to the format. I added a parser that converts the user input to a Date object. To prevent strange behaviour when parsing datetimes while the user is typing, I added a debounce to the input field. If the datetime isn't valid, the previously set datetime is kept.
The diff for the second half is a bit messy. The only thing I did is add
if (!scope.disableClick)around the handler for onFocus and increase the indentation.