第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在AngularJS中進行尋呼?

如何在AngularJS中進行尋呼?

大話西游666 2019-06-29 14:52:34
如何在AngularJS中進行尋呼?我有一個內存中大約有1000個項的數據集,并且試圖為這個數據集創(chuàng)建一個尋呼機,但是我不確定如何做到這一點。我正在使用一個自定義的過濾器函數來過濾結果,這很好,但不知怎么的,我需要得到頁數。有什么線索嗎?
查看完整描述

3 回答

?
慕仙森

TA貢獻1827條經驗 獲得超8個贊

角UI引導-分頁指令

檢查UI引導氏分頁指令..我最終使用了它,而不是這里發(fā)布的內容,因為它有足夠的特性來滿足我當前的使用,并且有一個徹底測試規(guī)范陪著它。

視點

<!--?table?here?--><pagination?
??ng-model="currentPage"
??total-items="todos.length"
??max-size="maxSize"??
??boundary-links="true"></pagination><!--?items/page?select?here?if?you?like?-->

控制器

todos.controller("TodoController",?function($scope)?{
???$scope.filteredTodos?=?[]
??,$scope.currentPage?=?1
??,$scope.numPerPage?=?10
??,$scope.maxSize?=?5;

??$scope.makeTodos?=?function()?{
????$scope.todos?=?[];
????for?(i=1;i<=1000;i++)?{
??????$scope.todos.push({?text:"todo?"+i,?done:false});
????}
??};
??$scope.makeTodos();?

??$scope.$watch("currentPage?+?numPerPage",?function()?{
????var?begin?=?(($scope.currentPage?-?1)?*?$scope.numPerPage)
????,?end?=?begin?+?$scope.numPerPage;

????$scope.filteredTodos?=?$scope.todos.slice(begin,?end);
??});});

遺留版本:

視點

<!--?table?here?--><div?data-pagination=""?data-num-pages="numPages()"?
??data-current-page="currentPage"?data-max-size="maxSize"??
??data-boundary-links="true"></div><!--?items/page?select?here?if?you?like?-->

控制器

todos.controller("TodoController",?function($scope)?{
???$scope.filteredTodos?=?[]
??,$scope.currentPage?=?1
??,$scope.numPerPage?=?10
??,$scope.maxSize?=?5;

??$scope.makeTodos?=?function()?{
????$scope.todos?=?[];
????for?(i=1;i<=1000;i++)?{
??????$scope.todos.push({?text:"todo?"+i,?done:false});
????}
??};
??$scope.makeTodos();?

??$scope.numPages?=?function?()?{
????return?Math.ceil($scope.todos.length?/?$scope.numPerPage);
??};

??$scope.$watch("currentPage?+?numPerPage",?function()?{
????var?begin?=?(($scope.currentPage?-?1)?*?$scope.numPerPage)
????,?end?=?begin?+?$scope.numPerPage;

????$scope.filteredTodos?=?$scope.todos.slice(begin,?end);
??});});


查看完整回答
反對 回復 2019-06-29
  • 3 回答
  • 0 關注
  • 536 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號