I have an existing angularjs app which was working fine until I converted it to ionic. I tested the website on the chrome browser and discovered that I can no longer scroll down to see a long table.
The only change I made was in the html code;
<!doctype html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=yes, width=device-width">
<title>test-view</title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="lib/ionic/js/bower_components/angular-material/angular-material.min.css">
<link rel="stylesheet" href="lib/ionic/js/bower_components/ng-table/dist/ng-table.min.css">
<link rel="stylesheet" href="css/app.css"/>
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<!--<script src="../../bower_components/angular/angular.min.js"></script>-->
<!--<script src="../../bower_components/angular-animate/angular-animate.min.js"></script>-->
<script src="lib/ionic/js/bower_components/angular-aria/angular-aria.min.js"></script>
<script src="lib/ionic/js/bower_components/angular-material/angular-material.min.js"></script>
<script src="lib/ionic/js/bower_components/angular-route/angular-route.min.js"></script>
<script src="lib/ionic/js/bower_components/angular-moment/angular-moment.min.js"></script>
<script src="lib/ionic/js/bower_components/angular-google-chart/ng-google-chart.js"></script>
<script src="lib/ionic/js/bower_components/moment/moment.js"></script>
<script src="lib/ionic/js/bower_components/angular-cookies/angular-cookies.js"></script>
<script src="lib/ionic/js/bower_components/ng-table/dist/ng-table.js"></script>
<div ng-include src="'partials/header.html'"></div>
</head>
<body>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers-func.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>
<div ng-controller="ViewCtrl" class="container">
<table ng-table="tableParams" class="table table-bordered">
<thead>
<tr>
<th>name</th>
<th>symbol</th>
</tr>
<thead>
<tbody>
<tr ng-repeat="vw $data">
<td data-title="'name'" >
{{vw.name}}
</td>
<td data-title="'symbol'">
{{vw.symbol}}
</td>
</table>
</div>
</body>
</html>
How to make the code scrollable?
Wrap this tag over your table.
<ion-content class="has-header" overflow-scroll="true">
<!-- table contents here -->
</ion-content>
The above code will use native scroll instead of js scroll. Note that it may not work with lower versions of Android. As long as you are using Android 4.2 and above, you are quite safe.
Since you are adding a html partial, I assume there is a header on your html. Therefore, use class="has-header".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With