In ionic 2 beta 6 I’m trying to scroll to a specific card in a list of cards:
<ion-card *ngFor="#item of items" [attr.id]="item.name" >
To do this i’m using the lifecycle hook onPageDidEnter, so that I will scrollTop when the page has fully entered ( as per the docs). My code looks like this:
onPageDidEnter() {
var el = document.getElementById(this.currentItem);
if (el !== null) {
el.scrollTop=0;
}
}
When I debug I can see how the view scrolls to the item right after el.scrollTop=0
but when I continue execution, somehow the view returns to the top and refuses to stay in the current item.
I have also tried several other angular 2 and ionic 2 hooks, but the behaviour remains the same; is there something I’m not seeing here?