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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在AngularJS中進(jìn)行尋呼?

如何在AngularJS中進(jìn)行尋呼?

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

3 回答

?
慕仙森

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊

角UI引導(dǎo)-分頁指令

檢查UI引導(dǎo)氏分頁指令..我最終使用了它,而不是這里發(fā)布的內(nèi)容,因?yàn)樗凶銐虻奶匦詠頋M足我當(dāng)前的使用,并且有一個(gè)徹底測(cè)試規(guī)范陪著它。

視點(diǎn)

<!--?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);
??});});

遺留版本:

視點(diǎn)

<!--?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);
??});});


查看完整回答
反對(duì) 回復(fù) 2019-06-29
  • 3 回答
  • 0 關(guān)注
  • 545 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)