如何在 angular4 CLI 项目中添加日期时间选择器

How to add datetime picker in angular4 CLI project

我需要有关日期时间选择器的帮助。我在 angular4 中尝试 https://github.com/dalelotts/angular-bootstrap-datetimepicker 但无法正确显示。换句话说,它根本不起作用。

我尝试在 .angularcli.json 文件中添加以下内容,但仍然无法正常工作。

     "styles": [
            "../node_modules/bootstrap/dist/css/bootstrap.min.css",
            "styles.css",
            "../node_modules/angular-bootstrap-datetimepicker/src/css/datetimepicker.css"
          ],
          "scripts": [
            "../node_modules/jquery/dist/jquery.js",
            "../node_modules/angular/angular.min.js",
            "../node_modules/moment/moment.js",
            "../node_modules/angular-bootstrap-datetimepicker/src/js/datetimepicker.js",
            "../node_modules/angular-bootstrap-datetimepicker/src/js/datetimepicker.templates.js"
          ]

我是 PrimeNG 的忠实粉丝。他们有很好的文档并且组件易于使用。

看看他们的 Date Time Picker

我在这里创建了一个日期时间弹出组件,它是 ngx-bootstrap 日期选择器和时间选择器的组合

https://github.com/Gillardo/ngx-bootstrap-datetime-popup

该组件仅适用于 Angular 5+。使用说明在自述文件中。参见 https://dalelotts.github.io/angular-bootstrap-datetimepicker/