The clearHistory() doesn't clear histories data

I have tried to clear all histories by using $ionicViewService.clearHistory() function. However, it seems that the histories are still remaining in the memory.


The console log for $rootScope.$viewHistory.histories indicated that they are quite similar between after and before running clearHistory(). The only different is the $rootScope.$viewHistory.histories.backView is set to null. The rest of histories data is still remaining.

Is it considered as a bug in v0.9.26?

1 Like

@phamaa Can you setup a CodePen sample please? We’ve got another poster with apparently the same issue:

With a sample setup, we can get an Issue opened and have the devs look at it.

Here comes the codepen
Click as many list as possible to see the log.

Thanks you.

@Calendee Were you able to check out the codepen posted by @phamaa ?

Sorry guys - I missed that somehow.

I’ve used the sample and can see that view history is not clearing.

Opened Issue # 724 :


The clearHistory() actually works well with the nightbuild. However, there might be another issue with the navigation menu. Please have a look.

If you check my codepen, you would easy to realise that all histories & views are stored, even though you hit the back button. They will be increasing all the time if you just navigate to the new item and hit back again. It might be a memory issue for mobile devices.

Should it clear the previous view (or history) when user hit the back button (or go back the the previous view)?