【发布时间】:2015-11-23 01:02:57
【问题描述】:
我正在现有的 Play Framework 2.0 应用程序中添加一些 angularJs 函数。
angularjs 文件在public/ 文件夹中提供。一切正常,直到我尝试使用带有分离模板的指令:
指令jsmulti-charts.js和指令模板multi-charts.html都放在同一个目录components/directives。
所以文件的完整路径是:
public/components/directives/multi-charts.jspublic/components/directives/multi-charts.html
问题是我无法使用templateUrl 访问指令内的模板文件。
指令:
app.directive('multiCharts', ['chartService', function(chartService){
return {
restrict: 'EACM',
templateUrl: 'components/directives/multi-charts.html',
replace: true,
link: function (scope, elem, attrs) {
}
}}]);
无法实现模板运行应用程序:
GET http://localhost:9000/company/components/directives/multi-chart.html 404 (Not Found)
更改templateUrl 内的路径不会改变错误。
我遗漏了一些东西,有没有办法在内部 Play Framework 网络服务器提供的指令中引用 html 模板?
【问题讨论】:
-
multi-charts.html != multi-chart.html 您缺少 s 还是只是示例中的拼写错误?
标签: angularjs angularjs-directive playframework playframework-2.0