Initially, angular caches only the templates themselves so as not to load them again from the server, without compiling using $cacheFactory .
In the project I have several places where the same directive is used.
I do not want the template to be compiled again when going to another page (let's say this is SPA, I moved to / restaurants with / deliveries, and then again to / deliveries), and took the cache and pasted it into the page.
Is there any way to do this for templates? Type specified when creating a directive or route cache: true
- what is meant by another page ? why do you think that now compiles again? How do you imagine the directive cache? - Grundy
- Sorry, template cache - jashka
- it is still not entirely clear what you want. If you have removed an element from the DOM, then without compilation and binding you will not do it again. If not cleaned - then now compilation is not called again. Try adding sample code / markup to make it clear what you mean - Grundy
- If you have removed an element from the DOM, then without compilation and binding you will not do it again. I mean it and I mean it. When the template is first compiled, it is inserted into the cache, the element is removed from the DOM, and then instead of compiling the template and linking it again, you can simply take this element from the cache and insert it into the DOM. So you can do? - jashka
- why do you think that is happening wrong now? how did you check? - Grundy
|