I have an with:
<span id="quote-{{quote.id}}" ng-repeat="quote in quotes">{{quote.text}}</span>
I'm trying to have an index to scroll to any part of the scroller using:
$scope.jumpToQuote = function (quote) {
$scope.quoteSelected = quote;
var quotePosition = $ionicPosition.position(angular.element(document.getElementById('quote-'+quote)));
$ionicScrollDelegate.$getByHandle('quotes-box').scrollTo(quotePosition.left, quotePosition.top, true);
}
However the value of quotePosition.top always equals 10 which is the top-offset of the <ion-scroll>
.
As far as i see, you need to replace document.getElementById('quote-'+quote)
with document.getElementById('quote-'+quote.id)
, You are concatenating whole quote
object instead of it's id
.
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