我正在设置一个Play Framework2.3服务器,并希望使用没有hashbang URL的AngularJS +ui路由器。只要我使用hashbang URL,路由显然工作得很好,但是我不能让html5mode工作。Play总是给我打404分。我该怎么做呢?
发布于 2014-10-31 07:13:31
好的,我让它工作了:
(我正在使用play-yeoman)
GET / controllers.Yeoman.index(name="")
GET /results controllers.Yeoman.any
GET /results/*any controllers.Yeoman.routing(any)
-> / yeoman.Routes
GET /assets/*file controllers.Assets.at(path="/public", file)和:
object Yeoman extends Controller {
def index = Action.async {
request =>
Assets.at("index.html").apply(request)
}
def any = Action.async {
request =>
Assets.at("index.html").apply(request)
}
def routing(path:String) = Action.async {
request =>
Assets.at("index.html").apply(request)
}
}因此,通过/results的路由由angular.js负责。它还负责/results路径,但如果我使用/*any,它会扰乱我的其他路由。希望它能帮上忙!
https://stackoverflow.com/questions/26660553
复制相似问题