<body ng-app="cacheExampleApp">
<div ng-controller="CacheController">
<input ng-model="newCacheKey" placeholder="anahtar">
<input ng-model="newCacheValue" placeholder="Değer">
<button ng-click="put(newCacheKey, newCacheValue)">Önbellek</button>
<p ng-if="keys.length">Önbelleğe alınmış Değerler</p>
<div ng-repeat="key in keys">
<span ng-bind="key"></span>
<span>: </span>
<b ng-bind="cache.get(key)"></b>
</div>
<p>Önbellek Bilgisi</p>
<div ng-repeat="(key, value) in cache.info()">
<span ng-bind="key"></span>
<span>: </span>
<b ng-bind="value"></b>
</div>
</div>
</body>
angular.module('cacheExampleApp', []).
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
$scope.keys = [];
$scope.cache = $cacheFactory('ÖnbellekID');
$scope.put = function(key, value) {
if (angular.isUndefined($scope.cache.get(key))) {
$scope.keys.push(key);
}
$scope.cache.put(key, angular.isUndefined(value) ? null : value);
};
}]);
This Pen doesn't use any external CSS resources.