Set up angular-cache.
Angular-cache is registered in the Bower package repository. With Bower you can install angular-cache and manage your app's dependency on angular-cache.
To install angular-cache, open a terminal in your project's directory and enter the command:
bower install angular-cache --save
This command will install the latest stable version of angular-cache.
Enter the following command to install a specific version:
bower install angular-cache#x.x.x --save
where x.x.x
is the version of angular-cache you want to install.
Download angular-cache manually here: Downloads.
Each release has a development version of angular-cache and a minified version.
Angular-cache should have installed to path/to/bower_components/angular-cache/
. You can reference the files in the dist/
folder, which contains development and minified versions of angular-cache.
Include angular-cache on your web page after angular.js.
<!-- After angular.js -->
<script src="/path/to/bower_components/angular-cache/dist/angular-cache.min.js"></script>
Include the version of angular-cache you downloaded on your web page after you include angular.js.
<!-- After angular.js -->
<script src="/js/plugins/angular-cache-2.1.0.min.js"></script>
Finally, list angular-cache as a dependency in your app's module definition.
angular.module('app', ['jmdobry.angular-cache']).config(function ($angularCacheFactoryProvider) {
// optionally set cache defaults
$angularCacheFactoryProvider.setCacheDefaults({ options... });
}).run(function ($angularCacheFactory) {
// Create a cache here, or anywhere else. Just inject $angularCacheFactory
var newCache = $angularCacheFactory('newCache', { options... });
});
See TRANSITION.md for details on breaking changes between versions.
After installing angular-cache with Bower, your bower.json
file lists angular-cache as a dependency.
"dependencies": {
"angular-cache": "~1.2.1"
}
The command:
bower install angular-cache -F --save
will install the latest stable version of angular-cache and save the change to your bower.json
.
Alternatively, you can specify the new version you want to install, for example:
bower install angular-cache#2.1.0 --save
.
bower prune
will remove the old installation of angular-cache.
Download the version of angular-cache you want as specified in the Download section.
Remember to update your references to angular-cache.