fatlog
fatlog

Reputation: 1192

Play framework and Angular - Loading angular templates

I have an Angular app which I am serving from Play. The main routes within Play all serve some HTML pages which contain ng-include statements to some angular templates which are in a "templates" folder in public...

<div ng-include="'@routes.Assets.versioned("templates/test.html")'"></div>

This works fine as I can use Play to reference the assets as normal. Now when the page loads in the browser, each of these templates load and in turn try to pull in further angular templates...

<div ng-include="'templates/test2.html'"></div>

But this results in a 404 as the "templates" folder cannot be resolved. How can I have a truly public "templates" folder with Play where each of angular can pull in whatever templates it needs in the browser?

Thanks

Upvotes: 0

Views: 137

Answers (2)

asch
asch

Reputation: 1963

In this link you can see the whole solution

Upvotes: 1

seekers01
seekers01

Reputation: 560

You will need something like this in your PLAY routes file:

GET /templates/*file controllers.Assets.at(path="/public/templates", file)

Upvotes: 1

Related Questions