Questions tagged caching

Explore the latest questions and answers asked by our top developers.

AngularJS: Using $templateCache to customize ui-select template

I want to customize ui-select template in certain places, So I am overriding it using templateCache like below example. ($templateCache) { ‘ngInject’; const templateName = ‘bootstrap/choices.tpl.html’; var template = $templateCache.get(templateName); template = template.replace("<span class="fa fa-minus"></span>", "<span class="fa fa-plus"></span>); $templateCache.put(templateName, template); }) The problem with above approach is it’s replacing the template in all ui-select […]

By MV reddy
Categorized as angularjs, caching, javascript, templates Tagged , , ,

Angular 2+ cached HTTP request force reload

In my angular service I have a cached http request which is called once when my component is initialized //variables private readonly URL: string = ‘’; private cachingSubject: ReplaySubject<IProduct[]> private _products: IProduct[] = []; //method public getAllProducts(): Observable<IProduct[]> { if (!this.cachingSubject) { this.cachingSubject = new ReplaySubject<IProduct[]>(1); this.http.get<IProduct[]>(this.URL) .subscribe((productsData: IProduct[]) => { this._products = productsData;; […]

Categorized as angular, caching, observable, rxjs, subject Tagged , , , ,

Angular service worker – return cached response if server returns error

I’m trying to configure service worker to fetch the data from the network and only return cached response in case of failure. I’ve added the following section to ngsw-config.json: "dataGroups": [ { "name": "config", "urls": ["/api/config"], "cacheConfig": { "strategy": "freshness", "maxAge": "1d", "maxSize": 1 } } ] Apparently it only returns cached response in case […]

Why is my Angular service worker caching all http requests?

These are the contents of my ngsw-config.json { "$schema": "./node_modules/@angular/service-worker/config/schema.json", "index": "/index.html", "assetGroups": [ { "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" ] } } ], "dataGroups": [ { "name": "first", "urls": ["http://localhost:3000/url"], […]

How to do Empty Cache and Hard Reload from js in Angular?

When I publish updates of my application I wish to be sure that all files .js, .png and so on will be downloaded with status 200, not 304. I tried to use this method: window.location.reload(true); But after it one can see that some files are still downloaded with 304 status. How to do Empty Cache […]

By mr blond
Categorized as angular, caching, html, javascript, reload Tagged , , , ,

How to force reload and clear cache in Typescript?

it recently came to my attention that simply using window.location.reload() is not a hard refresh i.e. cache is cleared along with the refresh. I was then told to use window.location.reload(true) but I discovered this has since been deprecated. I am not sure how to determine whether or not the cache has been cleared, so I […]

By Trey Aesthetics
Categorized as angular, caching, refresh, reload, typescript Tagged , , , ,

Angular 12: RangeError: Maximum call stack size exceeded

I am getting this error when building: Generating browser application bundles (phase: building)…/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:21 const lines = source.match(SPLIT_LINES_REGEX); ^ RangeError: Maximum call stack size exceeded at String.match (<anonymous>) at streamChunksOfSourceMapFull (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:21:23) at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:389:6) at SourceMapSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/SourceMapSource.js:211:11) at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17) at ReplaceSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/ReplaceSource.js:176:44) at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17) at streamAndGetSourceAndMap (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js:27:53) at CachedSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/CachedSource.js:208:35) at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17) I’ve […]

By Jette
Categorized as angular, build, caching, configuration Tagged , , ,

Angular 12 ignoring configuration files or reading from some cache?

Angular keeps warning me about IE 11: Warning: Support was requested for IE 11 in the project’s browserslist configuration. IE 11 support is deprecated since Angular v12. I came across this answer: Angular 12 warns about requested IE 11 support. Why? I changed my .browserslistrc file as recommended, and it now looks like this: last […]

By Jette
Categorized as angular, build, caching, configuration Tagged , , ,

Angular: homepage is rendering for a second before loading different route, even after I delete the contents of the homepage component template

I have a landing page using the pathname /private-howzatgolf-cookalong. Whenever I go to that path on our site, I can see the homepage briefly render on the screen for a second before loading the actual landing page. I also noticed if I completely delete the contents of the homepage component template and I navigate to […]

By Dominique
Categorized as angular, caching, nginx Tagged , ,

Cache or send changes every time to database?

Im working with Angular,NodeJS,MongoDB. Im looking for the best solution to store cart products to prevent load time at my eCommerce website that i’m building with "Angular,NodeJS,MongoDB", what would the best practice to do it ? The big issue that im dealing is when the customer will add quantity for his product and it can […]

1 2 3 6

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us