WebContent中的angularjs模板URL

WebContent中的angularjs模板URL,angularjs,jakarta-ee,angularjs-directive,Angularjs,Jakarta Ee,Angularjs Directive,我正在java dynamic web项目中开发angular应用程序,目录图: ->WebContent ---->javaScript ------>directives index.html 在我的指令文件夹中,我有表单指令: var app = angular.module('myApp'); app.directive('formDirective', formDirective); function formDirective() { var

我正在java dynamic web项目中开发angular应用程序,目录图:

->WebContent
---->javaScript
------>directives
index.html
在我的指令文件夹中,我有表单指令:

var app = angular.module('myApp');
    app.directive('formDirective', formDirective);

function formDirective() {

    var directive = {
        restrict: 'EA',
        templateUrl: 'formDirective.html', //the request
        scope: {
        },
        controller: FormControllerDir,
        controllerAs: 'vm',
        bindToController: true
    };
    return directive;
}
function FormControllerDir() {
    console.log('FormController');
}
并且
formDirective.html
放在同一目录下,但在根目录下对文件进行角度搜索:

GET http://localhost:8080/P2P/formDirective.html 404 (Not Found)
P2P是我的项目名称,如何将其更改为:

http://localhost:8080/P2P/JavaScript/directives/formDirective.html

因此,添加完整路径表单上下文很简单-


templateUrl:'JavaScript/directives/formDirective/formDirective.html'

也许可以在前面添加
/
templateUrl:'/formDirective.html'
怎么办。/formDirective.htmlmost,它重定向到子文件夹,是的,但这是发布答案的方式。