AngularJS cacheFactory not working -
this code:
app.directive('topnav', function(api, $cachefactory) { return { scope: {}, restrict: 'e', templateurl: 'packages/partials/includes/header.html', link: function($scope) { var cache = $cachefactory('datacache'); if( cache !== undefined ) { api.data().success(function(data){ $scope.phone = data.phone; $scope.mail = data.email; cache.put('data', data); }); } else { $scope.phone = cache.get('data').phone; $scope.mail = cache.get('data').email; console.log(cache.get('data')); } } }; });
the problem returns undefined , don't know what's going wrong, may go wrong ?
Comments
Post a Comment