19

刚刚重新安装了一些凉亭组件,但是这里有问题的组件没有更新,同样0.12.0 ui.bootstrap的。也ui-router 0.2.13用于将状态更改为另一个页面。

奇怪的错误信息是

Error: [$compile:ctreq] Controller 'datepicker', required by directive 'daypicker', can't be found!

但是当我查看 ui-bootstrap-tpls.js 文件时,datepicker 控制器直接定义在 daypicker 之上,并且应该被拾取。

这可能是由错误的冲突datepicker类名或其他原因引起的吗?

我知道这没什么好做的,但会在我有时间添加代码时更新。似乎datepicker某处可能存在冲突。它只发生在从一页到另一页的 stateChange 上。在最后一页之前,使用日期选择器的完整流程可以正常工作。如果控制器依赖项在同一个文件中,它怎么会丢失?

如果有人以前见过这种情况,我将不胜感激任何指导。

2015 年 4 月 23 日更新:正在使用带有表单的模式对话框,该表单将在单击确定时将用户发送到另一个页面。

4

3 回答 3

1

我有这个错误更新到 ui.bootstrap 0.14.x。

我在自己的模块中覆盖了导致问题的模板:

    angular.module("template/datepicker/datepicker.html", []).run(["$templateCache", function ($templateCache) {
    $templateCache.put("template/datepicker/datepicker.html",
      "<div ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" +
      "  <daypicker ng-switch-when=\"day\" tabindex=\"0\"></daypicker>\n" +
      "  <monthpicker ng-switch-when=\"month\" tabindex=\"0\"></monthpicker>\n" +
      "  <yearpicker ng-switch-when=\"year\" tabindex=\"0\"></yearpicker>\n" +
      "</div>");
    }]);

删除模块后它再次工作。

最初我已经更改了使用字体真棒图标而不是字形图标的模板。现在我覆盖 glyphicon css 类以更改字体真棒图标:

.glyphicon {
    font: normal normal normal 14px/1 ourIconFont;
}
.glyphicon-arrow-right:before,
.glyphicon-chevron-right:before {
    content: "\f054";
}
.glyphicon-arrow-left:before,
.glyphicon-chevron-left:before {
    content: "\f053";
}
于 2015-12-29T10:48:19.513 回答
0

有同样的问题,我们的解决方案是在升级到 uib 0.14 后,我们有一个用于 datepicker 的自定义模板,并且必须将 uib- 前缀添加到 datepicker 内的子指令(日、月、年)。例如

<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">
  <daypicker ng-switch-when="day" tabindex="0"></daypicker>
  <monthpicker ng-switch-when="month" tabindex="0"></monthpicker>
  <yearpicker ng-switch-when="year" tabindex="0"></yearpicker>
</div>

变成

<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">
  <uib-daypicker ng-switch-when="day" tabindex="0"></uib-daypicker>
  <uib-monthpicker ng-switch-when="month" tabindex="0"></uib-monthpicker>
  <uib-yearpicker ng-switch-when="year" tabindex="0"></uib-yearpicker>
</div>
于 2016-04-29T05:20:03.810 回答
0

您需要将 ui.bootstrap.0.12.0.js 更新为 ui-bootstrap-tpls-0.13.3.js

于 2015-10-26T11:28:43.433 回答