Angular bootstrap datepicker date format does not format ng-model value

后端 未结 13 1270
借酒劲吻你
借酒劲吻你 2020-12-01 04:24

I am using bootstrap date-picker in my angular application. However when I select a date from that date-picker underlying ng-model that I have bind gets updated I want that

相关标签:
13条回答
  • 2020-12-01 05:03

    The format specified through datepicker-popup is just the format for the displayed date. The underlying ngModel is a Date object. Trying to display it will show it as it's default, standard-compliant rapresentation.

    You can show it as you want by using the date filter in the view, or, if you need it to be parsed in the controller, you can inject $filter in your controller and call it as $filter('date')(date, format). See also the date filter docs.

    0 讨论(0)
提交回复
热议问题