用到的主要方法:
var location = $location.hash('id');//$location是angularjs的内置服务
$ionicScrollDelegate.$getByHandle('mainScroll').anchorScroll("#"+location);
主要代码
//html:
<ion-view title="Welcome">
<ion-content padding="true" delegate-handle="mainScroll">
<ul class="list">
<a ng-click="slideTo('location1')">Go to div 1</a>
<a ng-click="slideTo('location2')">Go to div 2</a>
</ul>
<div>
<h1 id="location1">Section1</h1>
<h3>content1</h3>
</div>
<div>
<h1 id="location2">Section2</h1>
<h3>content2</h3>
</div>
</ion-content>
</ion-view>
//js:
$scope.slideTo = function(location) {
var location = $location.hash(location);
$ionicScrollDelegate.$getByHandle('mainScroll').anchorScroll("#"+location);
};