Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Conversation

@decafdennis
Copy link
Contributor

This patch allows the use of datepicker in conjunction with an ngModelController that has custom formatters and parsers to translate between $modelValue and $viewValue.

In my particular use case, my model is a custom date value object. I'd like to bind it directly to the datepicker and handle the translation between the custom date value format and a Date object, with a formatter and a parser that's added to the ngModelController. This might be a somewhat obscure use, but it is valid and saves doing manual $scope.$watch's and so on.

Here's a demonstration of my use case: http://jsfiddle.net/dy8vvyey/7/

The datepicker directive, being the view, should really use the $viewValue, and it should be up to the user of the directive what the $modelValue looks like.

Allow use in conjunction with an ngModelController that has custom formatters and parsers to translate between $modelValue and $viewValue
@wesleycho
Copy link
Contributor

This makes a lot of sense - good catch!

Landed as 0ecf7fa.

@wesleycho wesleycho closed this Mar 22, 2015
@wesleycho wesleycho added this to the 0.13.0 milestone Mar 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants