我正在尝试从 laravel json 对 Backgrid 模板的响应中获取 json 值
我的 laravel json 响应是
return Response::json(
array(
'items'=> $articles->toArray()
));
它像这样响应json数组
{"items":[{"id":30,"title":"Tester","body":"tesrter","user_id":566,"user_nickname_id":0,"category_id":1,"community_id":0,"ref_link":"face.com","status":3,"points":0,"editor_id":566,"created_at":"2015-03-21 15:53:43","updated_at":"2015-03-21 09:23:43","category":{"id":1,"name":"Cupcake wrappers","description":"","created_to":"2015-02-27 13:53:15","updated_to":"0000-00-00 00:00:00"}}]}
我的 backgrid 单元格是
var CateoryType = Backgrid.Cell.extend({
template: _.template('<%=category.name%>'),
render: function () {
this.$el.html(this.template( this.model.toJSON() ));
this.delegateEvents();
return this;
}});
但我无法从 json 响应中获取 category 的名称。如何从我的 Backgrid Cell 或任何其他方式获取类别名称?