问题描述
根据文档输入[时间]: https://docs .angularjs.org/api/ng/input/input%5Btime%5D
使用输入类型时间并将其绑定到日期对象就足够了,但是它不能按我期望的那样工作.
<input ng-model="time" type="time" placeholder="HH:mm" min="08:00" max="17:00" required >
和
$scope.time = new Date();
作为结果,我只想在输入字段中看到HH:mm.
这是一个玩耍的jsfiddle:
http://jsfiddle.net/U3pVM/7314/
我认为您至少需要 Angular 1.3.0 beta 才能正常工作,因为它似乎是在随后引入的./p>
更改日志:
According to the Docs input[time]: https://docs.angularjs.org/api/ng/input/input%5Btime%5D
it should be enough to use the input type time and bind it to a date oject, however it doesn't work as I'd expect it.
<input ng-model="time" type="time" placeholder="HH:mm" min="08:00" max="17:00" required >
and
$scope.time = new Date();
as a Result I'd like to see just the HH:mm within the input field.
Here's a jsfiddle to play around:
http://jsfiddle.net/U3pVM/7314/
I think you need at least Angular 1.3.0 beta for this to work, as it looks like it was introduced then.
这篇关于使用angular.js输入类型时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!