0

I've done a lot towards optimisation of one part of my application, due to huge amount of elements in DOM. I implemented lazy loading, watched for every digest cycle to be as small as possible, etc.

Now my question is, if anyone else has encountered, that the initial compiling and rendering is slower than rendering for the second time(like navigate to different app location and back again).

Is angular caching somehow and if so, how can I force to cache it in advance?

2 Answers 2

1

$Routing in angular is done using $templateRequest which in turn utilizes $templateCache. That's why all consequent template changes looks faster.

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

Comments

1

Tools like gulp-angular on yeoman.io for example automatically will build your application and place your HTML files in the $templateCache for you. It will also concatenate and minify all of the scripts.

Ultimately what you are looking for is for the html snippets to be all included in that single javascript file so that there arent individual HTML GET requests for each one.

1 Comment

Yes, that was my first guess as well and I forgot to mention. I am caching all corresponding templates long before they are used. As well as images, but the problem is still present. Maybe JS files are the problem as they are not minified, but I don't see how that can be, as js files are loaded before used.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.