【问题标题】:datetimepicker using angular js in the script tag htmldatetimepicker 在脚本标签 html 中使用 Angular js
【发布时间】:2018-09-24 20:47:46
【问题描述】:
<div class='input-group date' id='datetimepicker'>
  <input type='text' class="form-control" ng-model="ctrl.startDate" />
  <span class="input-group-addon">
    <span class="fa fa-calendar"></span>
  </span>
</div>

在JS文件下面的代码,但我得到错误

$(function() {
  $('#datetimepicker').datetimepicker({
    icons: {
      time: "fa fa-clock-o",
      date: "fa fa-calendar",
      up: "fa fa-arrow-up",
      down: "fa fa-arrow-down"
    }
  });
});

在我得到的控制台中

datetimepicker 不是函数

【问题讨论】:

  • 如果你不了解 jQuery,但想使用它的功能,如 datepicker,那么你应该尝试ui.bootstrap module(与 Bootstrap 3 一起使用)或ui-bootstrap4
  • 不,我只想使用 jquey

标签: html angularjs bootstrap-4 datetimepicker


【解决方案1】:

在 jQuery() 上执行 console.log 并查看其所有原型,然后查看 datetimepicker 是否存在。您甚至可以在 chrome 开发工具或任何其他开发工具上执行此操作。

【讨论】:

  • 我们可以通过使用 Angular js 来使用吗?您对此有什么想法吗?我不知道 jquery
【解决方案2】:

您应该使用从中获取此代码的库。 我发现您可能在这里找到了您的代码:https://eonasdan.github.io/bootstrap-datetimepicker/#bootstrap-3-datepicker-v4-docs 如何安装库可以在这里找到:https://eonasdan.github.io/bootstrap-datetimepicker/Installing/

【讨论】:

  • 我在html中添加了所有的依赖
  • 您确定它们被添加到正确的位置吗?该错误表明您的代码找不到该函数。这可能意味着依赖项不可访问
猜你喜欢
  • 2019-03-16
  • 2023-03-27
  • 2019-08-03
  • 2014-03-16
  • 2023-03-25
  • 2023-03-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多