Work with $resources offline using localStorage in angular.js