简体   繁体   中英

Format input values to hour and minute format (hh:mm)

I have one input field for time entry , need to enter hour and minute (HH:mm Format) .So how can input values automatically formatting .

Eg: input values automatically formatting with HH:mm format (11:30).Any help would be appreciated.

You can use uib-timepicker directive for this purpose.It is easy to use and lot more customizable like you can switch between 12/24H etc. The doc explains it pretty clearly.

<div uib-timepicker ng-model="mytime" ng-change="changed()"
  hour-step="hstep" minute-step="mstep" show-meridian="ismeridian">
</div> 

you just write{{"HH:mm"}} in $scope

value = {{a.value | date: "HH:mm"}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM