Registry / testing / angular-cache-buster

angular-cache-buster

JSON →
library0.4.3jsnpmunverified

Cache Buster for AngularJS $http and $resource. Automatically appends a timestamp query parameter to HTTP requests to prevent browser caching, particularly useful for Internet Explorer (IE8, IE9). Stable version 0.4.3 (last released on 2015-08-05) with no breaking changes. Minimal configuration with regex-based matchlist (whitelist or blacklist) to control which URLs get cache-busted. No longer actively maintained; suited for legacy AngularJS 1.x apps only.

npm install angular-cache-buster
INSTALL
IMPORT
SIG · ANGULAR-CACHE-BUST
A
angular-cache-buster
testingjavascriptv0.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ngCacheBuster
angular.module('myApp', ['ngCacheBuster']);
<script src='angular-cache-buster.js'></script>
Import by adding module dependency (module name is 'ngCacheBuster'). Does not export a symbol.
httpRequestInterceptorCacheBusterProvider
angular.module('myApp').config(function(httpRequestInterceptorCacheBusterProvider) { ... });
angular.module('myApp').config(['httpRequestInterceptorCacheBusterProvider', ...]);
Provider is injected inside config block; name is 'httpRequestInterceptorCacheBusterProvider'.
setMatchlist
httpRequestInterceptorCacheBusterProvider.setMatchlist([/.*partials.*/]);
httpRequestInterceptorCacheBusterProvider.setMatchlist('/.*partials.*/');
Accepts array of RegExp objects or strings; second optional boolean argument 'true' for blacklist mode.

Complete setup: install Bower package, add module dependency, configure optional whitelist/blacklist, and use $http without modifying URLs.

// 1. Install: bower install angular-cache-buster --save // 2. Include script: <script src="bower_components/angular-cache-buster/angular-cache-buster.js"></script> // 3. Add module dependency angular.module('myApp', ['ngCacheBuster']) // 4. Configure (optional): bust everything except /api/cached .config(function(httpRequestInterceptorCacheBusterProvider) { httpRequestInterceptorCacheBusterProvider.setMatchlist([/\/api\/cached.*/]); }) // 5. Use $http normally – cache-busting query param '?cacheBuster=...' added automatically .controller('MyCtrl', function($http) { $http.get('/api/users').then(function(response) { console.log(response.data); }); });
Debug
Known issues
gotchaMatchlist entries must be RegExp objects or strings; if using strings, they are interpreted literally, not as regex patterns.
fix
Use RegExp objects: setMatchlist([/.*partials.*/])
affects: *
gotchaDefault mode is whitelist (cache-bust everything NOT matching). To use blacklist, pass second argument 'true'.
fix
setMatchlist([...], true) for blacklist
affects: *
deprecatedAngularJS 1.x is no longer under long-term support. This package is not compatible with Angular 2+.
fix
Migrate to Angular (2+) and use HTTP interceptors with native cache control.
affects: *
gotchaPackaged as a Bower component (not npm). Cannot be installed via npm install; use bower install.
fix
bower install angular-cache-buster --save
affects: *
gotchaQuery parameter name is hardcoded as 'cacheBuster'. Cannot be customized.
fix
No workaround; must fork or override.
affects: *
Errors
Common errors & fixes
Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr] Failed to instantiate module ngCacheBuster due to: Error: [$injector:nomod] Module 'ngCacheBuster' is not available!
Script file not loaded before Angular tries to bootstrap module.
fix
Ensure <script src='angular-cache-buster.js'></script> is included after angular.js.
Error: httpRequestInterceptorCacheBusterProvider.setMatchlist is not a function
Provider is not injected correctly. Config function must use the provider's name exactly.
fix
Use config(function(httpRequestInterceptorCacheBusterProvider) { ... }) and pass no parameters to the provider.
GET /api/users?cacheBuster=1234567890 404 (Not Found)
Server does not ignore extra query parameters; rejects request due to unknown parameter.
fix
Configure server to ignore query parameter, or adjust matchlist to avoid busting that endpoint.
Error: [$http:cachebust] Unexpected interceptor
AngularCacheBuster version mismatch or duplicate interceptors.
fix
Ensure only one instance of angular-cache-buster is loaded and that it is compatible with the AngularJS version.
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
30
OpenAI (training)
1
Resources
angular-cache-buster — npm install angular-cache-buster · libregistry