0
我开始学习CakePhp和AngularJs,我想让分页工作。CakePhp AngularJs分页
我发现这个简单的教程:http://florian-kraemer.net/2015/10/cakephp-angularjs-pagination/,但我不能让它工作。
这是从示例代码:
public function index() {
$query = $this->Table->find();
if (empty($this->request->params['paging'][$this->Table->alias()])) {
$paging = false;
} else {
$paging = $this->request->params['paging'][$this->Table->alias()];
}
$this->set('records', $this->paginate($query));
$this->set('paging', $paging);
$this->set('_serialize', ['records', 'paging']);
}
我的模式被称为进入,怎么我必须要改变的代码,这个例子的工作,我想它是这样,但它不工作:
public function index() {
$query = $this->Entry->find();
if (empty($this->request->params['paging'][$this->Entry->alias()])) {
$paging = false;
} else {
$paging = $this->request->params['paging'][$this->Entry->alias()];
}
$this->set('records', $this->paginate($query));
$this->set('paging', $paging);
$this->set('_serialize', ['records', 'paging']);
}
我不确定在我的代码中更改它以使其工作。任何帮助,将不胜感激。
谢谢,格雷戈尔