【发布时间】:2016-01-03 04:34:13
【问题描述】:
我是 Playframework 和 AngularJS 的新手,我在前端使用 AngularJS 并在后端使用 Playframework 开发应用程序。
我面临一种情况:当用户单击菜单链接(显示学生)时,它应该显示所有学生。在 play 动作中,数据以 json 格式发送。现在的问题是,如果数据作为 Json 发送,那么我看不到它应该转发到哪个页面的选项。 或者,我必须使用正常的播放框架样式,例如转发到带有值列表的页面。
//This is the current playframework code I use. Here I set the values to students form
// This is not the way I want
public static Result getAllEmployees(){
List<Student> all = Student.find.all();
JsonNode json = Json.toJson(all);
return ok(views.html.students.render(all));
}
//This is the way I want
public static Result getAllEmployees(){
List<Student> all = Student.find.all();
JsonNode json = Json.toJson(all);
return ok(json); // no option for specifying the page.
}
还有办法吗?
【问题讨论】:
标签: angularjs playframework playframework-2.0 playframework-2.2 playframework-2.3