【发布时间】:2016-06-06 19:10:48
【问题描述】:
我正在使用 restangular ngroute 和 playframework,我正在尝试按照本教程执行我的 CRUD:http://plnkr.co/edit/d6yDka?p=info
索引页面中的list.html和detail.html(在教程中),我把它们都放在customer.scala.html页面中,使用这个调用主页:@main(“MyApp”)所以所有我的控制器和模型在这个主页中定义。
那么我该如何进行路由,当我点击一个按钮时,我可以调用在我的 js 页面中定义的链接 (localhost:9000/custd):
app.config(function($routeProvider, RestangularProvider) {
$routeProvider.
when('/custd', {
controller:ListCtrl,
templateUrl:'list.html'
}).
更新: 这是 customer.scala.html 中的链接
<li><a href="@routes.Application.custDetail()">Customers</a></li>
在 Application.scala 文件中我有这个:
def custDetail = Action {
Ok(views.html.custDetail("Your new application is ready."))
}
在路线中我有这个:
GET / controllers.Application.index
GET /custdetail controllers.Application.custDetail
那么我怎样才能将这个:/custd(在角度控制器中)与我的 html 页面链接起来
【问题讨论】:
-
"how can I do the routing" 是一个非常模糊的问题,请详细说明您的具体问题是什么。
-
请检查更新
-
你看过play框架文档的javascript routing page吗?
-
如果您在服务器上进行所有路由,很难弄清楚为什么需要角度路由器。如果您正在构建单页应用程序或服务器端应用程序,您似乎需要下定决心。
-
我正在构建一个服务器端应用程序,所以我必须为每个班级使用 restangular 进行 CRUD。例如,此链接 /custd 必须向我显示与 customerdetail 相关的页面。 (我是初学者)
标签: html angularjs scala playframework restangular