I started an app with Playframework (Scala) and AngularJS v1.3
.
(Exactly the template Play Silhouette Angular Seed)
Loading difference templates using ng-include or a directive.
Always that I put a reference in Angular code, it doesn't work.
Example:
<div ng-include="'/tpl.html'"></div>
<script type="text/ng-template" id="/tpl.html">
Content of the template.
</script>
Result: works!!
Now, if I put the template tpl.html
in a file in the same directory:
<div ng-include="'tpl.html'"></div>
Result: Doesn't work!! (And in other directories, I tried all the possible routes...)
The same problem occurs in directives, if I put the template inside the directory it works well, but if I try to put in another file it doesn't work.
I used Angular in other projects and never occurs something like this. I think that this happens because Scala (language of Playframework) needs to be compiled and the files .scala.html
are converted in .html
.
.html
and then with ng-include
put the correct reference?The root directory is the same that index.html
file (path: ui/app
).
If the file view1.html
is in the path ui/app
, the ng-include will be like this:
<div ng-include="'./view1.html'"></div>
Because ui/app
is the root path.