Angular bootstrap ui 时间选择器找不到模板
Angular bootstrap ui timepicker can't find the templates
我用日期选择器的模板构建了bootstrap-custom.js构建,尽管该文件包含如下模板:
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" +
" <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
" <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
" <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>");
}]);
我叫这个js。从我的 index.html 正确提交文件,我收到以下错误:
Error: [$compile:tpload] Failed to load template: template/datepicker/datepicker.html
我假设我必须更改它的路径,但我必须更改什么才能正确引用模板?
感谢任何帮助,谢谢。
编辑 1
bootstrap-custom.js
angular.module("ui.bootstrap.tpls", ["template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/timepicker/timepicker.html"]);
angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
看来我第一条评论的猜测是正确的
由于您将模板定义为不同的模块,因此您需要将该模块直接或间接(通过其他模块)包含到您的主应用程序中
直接包含
angular.module("myUberApp", ["template/datepicker/datepicker.html"]);
间接包含
angular.module("myUberApp", ["myOtherModule"]);
angular.module("myOtherModule", ["template/datepicker/datepicker.html"]);
我用日期选择器的模板构建了bootstrap-custom.js构建,尽管该文件包含如下模板:
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" +
" <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" +
" <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" +
" <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" +
"</div>");
}]);
我叫这个js。从我的 index.html 正确提交文件,我收到以下错误:
Error: [$compile:tpload] Failed to load template: template/datepicker/datepicker.html
我假设我必须更改它的路径,但我必须更改什么才能正确引用模板?
感谢任何帮助,谢谢。
编辑 1
bootstrap-custom.js
angular.module("ui.bootstrap.tpls", ["template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/timepicker/timepicker.html"]);
angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
看来我第一条评论的猜测是正确的
由于您将模板定义为不同的模块,因此您需要将该模块直接或间接(通过其他模块)包含到您的主应用程序中
直接包含
angular.module("myUberApp", ["template/datepicker/datepicker.html"]);
间接包含
angular.module("myUberApp", ["myOtherModule"]);
angular.module("myOtherModule", ["template/datepicker/datepicker.html"]);