performanceionic-frameworktabbed-interface

How to get better performance for ionic using tabbedslidebox?


Hi I am using https://github.com/saravmajestic/ionic/tree/master/tabbedSlideBox

It works great for scrollable tabs, but I find that as I use more than a few scrollable tabs (more than 4-5 tabs) the performance drops considerably. This is because it's trying to create the view content for all the tab-slide-boxes at the start.

I have tried to use it with 30 scrollable tabs and it takes about 3-4 seconds to show the first tab.

What would be the way to delay the creation of the view content until the slide-change event for all the other tabs except for the tab in focus? That way the focused tab can load quicker and other tab views can be shown with a spinner when the user taps on the tab.


Solution

  • I had a similar issue with the ion-slide-box. When i had more then 5-6 slides, The performance decreased drastically. I took more then 10 seconds to load a slide.

    My solution for that was to construct only 3 slides at any time - the current slide, the next one and the previous one.

    I used this trick: Wrap the content of your slide in a DIV and add the ng-if like this

    <ion-slide-box class="blackBg" on-slide-changed="slideChanged(index)" show-pager="false" active-slide="photoIndex">
    
            <ion-slide ng-repeat="photo in photos track by $index">
    
                <div ng-if="$index >= (photoIndex-1) && $index <= (photoIndex+1)">
    
                     // You slide content here...
    
                </div>
    
           </ion-slide>
    
    </ion-slide-box>