From 300263abec0337b81d2384e9dbed7b7943500c1b Mon Sep 17 00:00:00 2001 From: Trevor Ewen Date: Wed, 5 Mar 2014 20:39:13 -0500 Subject: [PATCH] docs($cacheFactory): add example --- src/ng/cacheFactory.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/ng/cacheFactory.js b/src/ng/cacheFactory.js index 69c4ed93..c542a43a 100644 --- a/src/ng/cacheFactory.js +++ b/src/ng/cacheFactory.js @@ -37,6 +37,46 @@ * - `{void}` `removeAll()` — Removes all cached values. * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. * + * @example + + +
+ + + + +

Cached Values

+
+ + : + +
+ +

Cache Info

+
+ + : + +
+
+
+ + angular.module('cacheExampleApp', []). + controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) { + $scope.keys = []; + $scope.cache = $cacheFactory('cacheId'); + $scope.put = function(key, value) { + $scope.cache.put(key, value); + $scope.keys.push(key); + }; + }]); + + + p { + margin: 10px 0 3px; + } + +
*/ function $CacheFactoryProvider() {