Angular anchor jump within same page

I have recently inserted a “jump to anchor” within a page on my Angular page. When clicking on the href it scrolls down correctly but it returns to the start position directly after. I can’t figure out what is the issue.

HTML:

<a ng-click="scrollTo('my-location')" ui-sref="partial.page"></a>
<a id="my-location"></a>

JavaScript:

$scope.scrollTo = function (hash) {
   $location.hash(hash);
}

I tried preventing the default, like this:

HTML:

JavaScript:

$scope.scrollTo = function (hash, $event) {
   $event.preventDefault();
   $location.hash(hash);
}

And that solves the jumping problem, but it’s not opening the partial page within the page anymore.

How do I make it scroll to, not jump back, and open the partial page?