2016-08-18 128 views
0

我使用的是Restangular庫在我angularjs application.I想要從靜止api.Whenever所有註冊用戶的信息,我讓Restangular GET請求來做到這一點,僅檢索100條記錄,而我有周圍250+用戶對於我website.I've使用Restangular GET請求返回100個記錄

Restangular.all('url').getList({limit:200,offset:0}) 
    .then(function (success) { 
    //some code  
    }); 

這是出路提到here嘗試,但它不是爲我工作。

+0

迪迪你試過後不解決偏移? – DMCISSOKHO

+1

檢查服務器端 - 極限可能是有 –

+0

@DMCISSOKHO是的,我試過沒有偏移它不工作要麼 –

回答

0

發現了一些時間

RestFullResponse.all('url').getList().then(function (success) { 
    var headers = success.headers(); 
    var currentpage = headers['x-pager-current-page']; 
    var lastpage = headers['x-pager-last-page']; 
    for(currentpage; currentpage<=lastpage; currentpage++) { 
    var param = { 
     "page_entries": 100, 
     "page":currentpage, 
     "offset": (currentpage-1)*this.page_entries 
    };    
    RestFullResponse.all('url').getList(param).then(function (success) { 
     personList = personList.concat(success['data']); 
    }); 
    } 
});