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']);
}
我不確定在我的代碼中更改它以使其工作。任何幫助,將不勝感激。
謝謝,格雷戈爾