I'm trying to store an array in AngularJS' $cacheFactory. When I try to get the array it's returning undefined.
Here's my code:
angular.module('cacheExampleApp', []).
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
$scope.myArray = [
"one",
"two",
"three"
];
$scope.keys = [];
$scope.cache = $cacheFactory('cacheId');
$scope.put = function(key, value) {
$scope.cache.put(myArray, $scope.myArray);
$scope.keys.push(key);
};
console.log("myArray is:");
console.log($scope.cache.get($scope.myArray));
}]);
...and Plunker.
Any ideas what I'm doing wrong?