推荐的AngularJS / Bootstrap日期选择器是什么? [英] What is the recommended date picker for AngularJS/Bootstrap?

查看:90
本文介绍了推荐的AngularJS / Bootstrap日期选择器是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Angular / Bootstrap时,有几种选择可以添加日期选择器控件。有一个更好的东西吗?

There are several choices for adding a date picker control when using Angular/Bootstrap. Is there one that is "better"?

这是我发现的东西:


  • 日期的HTML 5输入类型:不同浏览器中不一致的支持

  • angular-ui / ui-date:似乎是一个基于指令的简单解决方案,围绕着JQueryUI日期选择器。

  • ui.bootstrap.datepicker:提供用户可能喜欢的弹出样式,并且不依赖JQuery。

乍一看,Bootstrap日期选择器似乎更易于使用,因为它不需要包含JQuery。但是我不确定是否会丢失这种功能。

At first glance, it seemed that the Bootstrap date picker may be easier to use because it does not require including JQuery. But I wasn't sure if I was losing any functionality going that way.

推荐答案

Angular-ui的bootstrap日期选择器是更好的选择。使用较新版本的Angular,可以在两个方向上解析日期的输入类型,并且可以与angular-ui引导日期选择器一起使用。 (对于较早的版本,您可以修补角度以使用日期输入类型)。当然,angular-ui datepicker也可以在没有日期输入类型的情况下工作(它只是一个额外的好处)

Angular-ui's bootstrap datepicker is the better choice if you already include bootstrap in your angular project. With the newer version of Angular, input types of date can be parsed in both directions and will work great with angular-ui bootstrap datepicker. (with older version, you can 'patch' angular to work with date input types). Of course the angular-ui datepicker can work without the date input type as well (its just an added bonus)

在使用angular-ui bootstrap datepicker之前,我们使用了jquery ui的datepicker,并且围绕日期的值(不是JavaScript日期)存在一些问题。最初,它可以完成我们想要的一切,但是当尝试做更复杂的事情时,我们遇到了问题。

Before using the angular-ui bootstrap datepicker, we used jquery ui's datepicker and had some problem around the value of the date not being a javascript date. At first it was fine and did everything we wanted, but when trying to do more complex things we ran into problems.

您可能可以通过使您的jquery ui问题解决自己的指令并进入实质,但是angular-ui的bootstrap datepicker可以直接使用。

You could probably solve the jquery ui problems by making your own directive and getting into the nitty-gritty, but angular-ui's bootstrap datepicker just works out-of-the-box.

这篇关于推荐的AngularJS / Bootstrap日期选择器是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆