My guess is that the problem could be $scope.list method in the controllers-transactions.js which is being called every time, which refreshes the list of transactions, so you are not using cached version.
@bokboki2002 I appreciate you taking a look at this.
I took your advice and removed the scope.list method from being called every time but it didn’t work. Then I decided to create a codepen to see if I could recreate the issue but the scroll position is remembered in the codepen sample
The only difference I see is that in the codepen I am using the nightly builds. How can I use the nightly builds in my app? I want to test that possibility
I’ve been looking at your live example one more time and comparing that to codepen example. Difference is that in codepen views are cached (in ion-nav-view element there are two child elements - one cached - previous view and another active - current view.
In live example there is only one active view, which is the reason why when you go back view is recreated and scroll position is lost.
Maybe you have disabled cache somewhere in your setup?
You see the navigation remembers the possition when you go back to the list but when you try to recreate this locally there is no way to make it work. I have similar problem here
The only difference is I am no using nightly builds, just latest 1.0 release There must be some simple trick to this. I do not think I need to enable some extra caching when codepen don’t.
when I look at the JSdoc there is a note about
$ionicConfigProvider.views.forwardCache(true);
but not sure if it applies in this context of problem.
@bokboki2002 I have not disabled cache anywhere as I don’t even know how to do that just yet (still a noob). @fkbart is right, in codepen everything works well but NOT on a local environment,
Here’s what I did:
Downloaded the latest nightly 1.0.0-nightly-1373 (2015-06-12) to my local
I copied the exact code from my codepen posted earlier to my app
Tested locally and scroll position is not remembered
Uploaded to Firebase and same behavior (it doesn’t work)
@gigocabrera No need to feel bad. Learning advanced things in a new framework is almost always a painful process. But as you said it, you learned one more new thing
Happy coding!
Btw. did this helped ?
I do not have such thing in my code as I let the framework to use default value 10. I need to try then highly build , this is the only diff I have now.
So nightly build did not really worked which means I will have to find a time I need to put together a codepen. Cuz just like in your case you think you have it correct, you can see identical things like the others but for some reason it does not work.
In My case my structure is little bit different :
I have list ION-LIST -> Collection repeat.
Details is not ionic content -but tabs, and each tab has ion-content.
My LIST is loaded only once. so We will see.
@bokboki2002 btw. I wonder where do you see in the ionic code that this or that view is cached so I can do little home work (debugging) on my side to see, where they put in view in case, and when coming back to list view they take it out.
@fkbart, here is how you can do debugging:
Using Chrome, open Developer tools. I also usually toggle Device Mode (small Mobile icon in the top left corner of Developer tools, next to Search icon), to emulate specific device.
For this specific problem that @gigocabrera had I was looking directly at DOM elements and how are they created and destroyed.
What I noticed is that one <ion-view> element was created (main list) and then when the details view was presented, main list <ion-view> got destroyed and another one got created for details view.
Normally, when cache is applied, both views are in the DOM. It is just that one has attribute nav-view="cached" and another one has nav-view="active".
I was just thinking exactly what you just described in second part + if inside ionic -> ionic-bundle inside some directive / or other code implementation you have seen this. put into the cache, retrieve from cache, current list of elements inside cache, etc…
Just for the record. Not sure if this is a bug or not but my problem with not remembering position was cased by detail page.
Evertime I access the detail view I want the view to be always scroll all the way to the top even you accessed it before. so in the controller I call
$ionicScrollDelegate.scrollTop();
But then if I decide to hit BACK button to go back this scrollTop() injected only to this detail view also affect the PART list view. When I remove it my collection repeat nicely remember the position.