简体   繁体   中英

AngularJs/Yeoman/Grunt Play Framework blank page

Today I decided to try out AngularJs with play framework, I've created a folder inside my public folder called AngularJs, in which i have generated an angular app with yeoman.

After generating the sources with grunt build, in the route folder of play, I've put:

GET         /                               controllers.Assets.at(path="/public/javascripts/angularJs/src/dist", file="index.html")

Now the problem I am facing is that the index page is well retrieved but Angular doesn't load the templates.

Anyone have a clue?

Ok now I get it after fiddling around for a moment, the problem with angularJs and Play framework, is that play must serv all the angularJS resources, so the solution to the problem, is to create routes to the angularJs dist folder in your public play application folder.

for an angularJs application created with Yeoman and generated using "grunt build", you must define these routes :

GET         /scripts/*Asset                               controllers.Assets.at(path="/public/javascripts/angularJs/scripts", Asset)   
GET         /views/*Asset                               controllers.Assets.at(path="/public/javascripts/angularJs/views", Asset)   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM