Change URL without reload scope to a fast load


#1

Hello,
I have a view that is heavy (slide-box with 12 slides and dynamic content) and takes 2-3 seconds to load it.

When I change URL to another view and go back, the heavy view has to be reload and it blocks the user interaction.

It’s possible to store scope of the heavy view and when user go back to this view simply reload scope?

Thanks!


#2

You can create a service for the view and store and recreate the dynamic $scope contents from the service .


#3

Can you elaborate with some code example ? I have a list with ~200 items which takes time to load too.


#4

Is it taking time to load the data or render the view? Caching the data in a service will reduce and possibly eliminate load times when revisiting the page that has had data already loaded from a lengthy data query.

If the load time is front rendering the view, I’m not sure…


#5

i recently integrated bindOnce and it improved my list view performance.


#6

Down the road, Ionic will be implementing cached views for “back” support. However, I have no timeline on that.

So, as others have asked, where is the delay? Rendering the data or fetching the data? If the delay is due to fetching, the Service that was suggested would solve that problem.


#7

Hello, thanks all for your answers.

The problem isn’t charge data. Is slow because have to initialize 3 DOM objects (fullCalendar).

Any other idea?

Thanks very much


#8

It’s going to be hard to help without us seeing the actual code. Can you setup a CodePen sample?


#9

Of course!
Is my first codepen, but I think is ok.
Is an example, real code does more stuff, but as example is enough.

To see the delay I’m talking you can press an event and when go back you can see it.
In browser is fast, the delay is small, but in a device this delay is about 3-4 seconds

Thanks!


#10

Okay I have this on my device now. It’s an iPhone 5S. It’s reasonably fast. It takes about 1 second to transition back from the detail view to the calendar.

I’ve also got it running on a very old iPhone 4S. It is slow. About 2 to 3 seconds.

I’m not sure this can really be optimized much more. It’s got 3 slides - each with pretty intensive layouts.

I did remove the last 2 slides and performance on the 5S is perfect. Performance on the 4S is pretty good - less than 1 second transition.

I feel like you might need to refactor to not use a Slide Box for this. How about just using a single view and using a swipe detection to change the calendar out? Possibly use little arrow indicators on the left and right about middle of the page to indicate previous month and next month? You could also use buttons in the header to show that.


#11

Thanks so much for tests.

I’m working in the solution without slides and I’m happy about the iPhones times.

Another time, thanks!