Matjaž
Matjaž

Reputation: 2115

How to cache AngularJs *.js files

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!

Upvotes: 2

Views: 1648

Answers (1)

Matjaž
Matjaž

Reputation: 2115

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.

Upvotes: 1

Related Questions