标签:color blog scope bsp adl 显示 nbsp false size
// 假如拿到数据少于3条,就只显示数据,
//多于三条,显示更多标记,点击更多显示全部,
//点击收起,回复到第二种状态
code1
<div ng-if="!reOver" ng-click="ticMore(‘More‘)"></div> <div ng-if="tkmore && isOver" ng-click="ticMore(‘More‘)"> <div class="tricon">更多</div> </div> <div ng-if="!tkmore" ng-click="ticMore(‘PackUp‘)"> <div class="tricon">收起</div> </div>
code2
$scope.tkmore= false; $scope.tkOver= false; $scope.tcMore = function(type){ switch(type){ case‘loadlist‘: $scope.ticketlist = $scope.more(data.ticketlist,"loadlist"); if($scope.by.length>3){$scope.tkOver= true;} $scope.tkmore= true; break; case‘PackUp‘: $scope.ticketlist = $scope.more(data.ticketlist,"PackUp"); $scope.tkmore= false; break; case‘More‘: $scope.ticketlist = $scope.more(data.ticketlist,"More"); $scope.tkmore= true; break; } } $scope.tcMore(‘loadlist‘);
code3
.factory(‘commonfn‘,function($state,$ionicHistory,$ionicScrollDelegate, $cordovaToast,$rootScope,$ionicPopup){ // commonfn.init($scope) return{ init: function($scope){ // 下拉显示 $scope.more = function(arrList,type,flag,num){ var num =(num)?num:3; var arr =[]; switch(type){ case‘loadlist‘: arr = arrList.slice(0,num); flag = !flag; break; case‘PackUp‘: arr = arrList.slice(0,num); flag = !flag; $ionicScrollDelegate.resize(); break; case‘More‘: arr = arrList; flag = !flag; $ionicScrollDelegate.resize(); break; default: break; } return arr; } }, } })
标签:color blog scope bsp adl 显示 nbsp false size
原文地址:http://www.cnblogs.com/alan-alan/p/7382539.html