【问题标题】:How to add a "datetime" picker for angular js application?如何为 Angular js 应用程序添加“日期时间”选择器?
【发布时间】:2015-12-26 01:49:02
【问题描述】:

我正在开发一个有角度的 js 应用程序。它有一页,输入为日期。我需要添加一个日期作为输入。

Date Input

<input type="date" ng-model="InputDate" />

我该怎么做?

【问题讨论】:

  • 希望指南或简单示例如何输入日期。

标签: angularjs html input twitter-bootstrap-3 datetimepicker


【解决方案1】:

您可以使用 Angular Bootstrap 组件:https://angular-ui.github.io/bootstrap/#/datepicker

【讨论】:

    【解决方案2】:

    如果您想要一个简单的解决方案,考虑到您不想仅为应用程序中的日期时间选择器注入额外的依赖项,请使用内置方法:

    <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
      placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
    

    More information on date-time picker | AngularJS API Reference

    但是,如果您的应用需要在多个视图中输入日期时间,那么也许您也可以使用其他额外的第三方模块(只需 google 即可)。采用这种方式的主要优势之一是让您的应用用户遇到更好的 UI/UX。

    【讨论】:

      猜你喜欢
      • 2021-06-22
      • 1970-01-01
      • 2018-02-13
      • 2018-05-13
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多