How to navigate to particular id using href of a tag?

Ah okay… now i get your problem^^.

http://ionicframework.com/docs/api/service/$ionicScrollDelegate/
every scroll-container (ion-content, ion-scroll) can handle a name attribute.
with the $ionScrollDelegate you can get such a scroll container with $ionicScrollDelegate.getByHandle().
If you get your ion-content with that function -> you can put a ng-click function on your links and in your function use:
$ionScrollDelegate.anchorScroll() to scroll to a dom node with a given id.

if you only have ion-content as scroll-container on your view you can use something like this:

$scope.scrollTo = function (id) {
  $ionScrollDelegate.anchorScroll(id);
};

if you have more than one:

$scope.scrollTo = function (id) {
  $location.hash(id);
  var delegate = $ionScrollDelegate.getByHandle('content');
  delegate.anchorScroll();
};

Template:

<ion-content delegate-handle="content"></ion-content>

Greetz and good night, bengtler.

2 Likes