2

I'm building quite big Angular application. I have some problems with caching *.js files. Every time route is changed, all *.js files are downloaded.

enter image description here

I know I should join all js files and minimize them, but first I want figure following problem.

One problem is that all requests have ?_=<rondom_number> appended on end of URL. And I don't know how to remove that.

Thanks!

4
  • How are you loading your angular files? Commented Apr 20, 2016 at 16:22
  • @Tuvia On bottom of index.html body github.com/matjazmav/tpo10/blob/sprint1/index.html Commented Apr 20, 2016 at 16:23
  • 1
    It's not random number. I think It's a timestamp that using to avoid caching that added by jQuery to every request. Try this on page load: jQuery.ajaxSetup({cache: true} Commented Apr 20, 2016 at 16:43
  • Thank you, now it is caching :) Commented Apr 20, 2016 at 18:31

1 Answer 1

1

As @rootatdarkstar suggested I have included this line of code:

$.ajaxSetup({cache: true});

Loading speed is definitely better, from about ~5s to about ~300ms. Now all files are taken from cache next step is to join and minimize all js files in to one file.

Thanks again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.