ionic tabs doesn’t update view while changing from tab to tab, unless a pop appears,
here is tab1
and here it’s the second tab files that’s supposed to be highlighted in the tabs bar and zeros should be the numbers of files
and here is how it updated when the alert showed …
and this issue isn’t only happening to the ionic tabs I have an other page that it’s view is supposed to be changing whenever I change a variable to true or false for example :
but it’s issue is it is always showing the view according to the first value of the variable, and only changes it when an alert shows…
sometimes everything works perfectly, and when I reload the issues comes back…
I don’t have anything concrete to back this up, but it seems to me that <ion-item> gets cranky when its children appear and disappear via change detection. The heuristic I have come up with is to only use structural directives (such as ngIf and ngFor) on the <ion-item> itself, not on anything underneath it.
I got you, but do you have any idea why tabs changing does like that? because it’s too weird, last night it was working perfectly, whereas today, somehow it started having that view update issue, I looked in the forums, and all of them mentioned that I should use ngZone, but, I didn’t where should I use ngZone exactly in the tabs changing code…
I don’t think it has much of anything to do with tabs per se, but rather structural directives.
I would strongly recommend against starting down that road. You should not need to be manually dealing with zones ever. The only reasonable place for doing that is when dealing with external libraries like cordova plugins, and that is why ionic-native exists (to deal with zonifying them so app code doesn’t have to).
Hmm, I’m not seeing any <ion-item>s at all. I assume what you’ve posted here is contained inside an <ion-fab>. Does anything change if you move the ngIf directives up to it instead?
I’m afraid I can’t because the client’s rules is to not let anything of the app’s code on github…
but I’ll post pages that has errors code here in replies
the users view started updating no matter where my *ngIf was.
like it is showing here :
before calling the compactlist() methode :
and after calling the compactlist() methode :
and it is still working no matter how many times I reload the page, not like before, when the view was only updating when something else shows up.
The issue now is still in the view update from tab to tab,… is there anyhow to change tabs using ngZone ?