1. 程式人生 > >ionic js

ionic js

esc direction ret tex ide HA func sta tabs

1.在tabs導航中,部分子頁面隱藏底部選項卡

tabs添加:

<ion-tabs class="tabs-icon-top tabs-light " ng-class="{‘tabs-item-hide‘: $root.hideTabs}">

要隱藏選項卡的子頁面:

<ion-nav-view hide-tabs="true" >
    <ion-header-bar  hide-tabs="true">

direction:

app.directive(hideTabs, function ($rootScope) {
    return
{ restrict: A, link: function (scope, element, attributes) { scope.$on($ionicView.beforeEnter, function () { scope.$watch(attributes.hideTabs, function (value) { $rootScope.hideTabs = value; }); }); scope.$on(
$ionicView.beforeLeave, function () { $rootScope.hideTabs = false; }); } }; });

2.設置導航的過渡方向:

nav-direction="forward"  //back

JS中:註入

$ionicViewSwitcher

使用:

$ionicViewSwitcher.nextDirection("forward");

3.下拉刷新

 <ion-refresher pulling-text="下拉刷新" on-refresh="
shuaxin()"></ion-refresher>
 $scope.shuaxin = function () {
        $scope.items = [//新items]
        $scope.$broadcast(scroll.refreshComplete);
    }

4.滾動條到底加載

 <ion-infinite-scroll on-infinite="loadMore()" distance="1%"></ion-infinite-scroll>
$scope.loadMore = function () {
        $scope.items = [];
        $scope.$broadcast(scroll.infiniteScrollComplete);
    };

$scope.$on(‘stateChangeSuccess‘, function () {
$scope.loadMore();
});

 

ionic js