2017-07-04 9 views
0

ich meine Winkel app in Java dynamische Web-Projekt, Verzeichnis Karte deplying:AngularJS templateUrl in WebContent

->WebContent 
---->javaScript 
------>directives 
index.html 

und in meinen Richtlinien Ordner habe ich Form Richtlinie:

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'); 
} 

und formDirective.html platziert unter dem gleichen Verzeichnis, aber eckige Suche nach der Datei unter root:

GET http://localhost:8080/P2P/formDirective.html 404 (Not Found) 

P2P ist mein Projekt ct Name, wie ändere ich es an:

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

vielleicht fügen Sie '/' vor 'templateUrl:‚/ formDirective .html'' –

+0

was ist mit ./formdirective.html – gianni

+0

fast, es umleiten zu Unterordner, ja, aber das ist der Weg, Entsendung Antwort. –

Antwort

0

So war es einfach fügen Sie einfach den vollständigen Pfad Form Kontext -

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

Verwandte Themen