Skip to content

Instantly share code, notes, and snippets.

@umdstu
Last active August 19, 2016 17:39
Show Gist options
  • Save umdstu/64911f4d7a957673afafb0d7b2c63702 to your computer and use it in GitHub Desktop.
Save umdstu/64911f4d7a957673afafb0d7b2c63702 to your computer and use it in GitHub Desktop.
CoolService.getCool($scope.id).then(function(resp) {
$scope.cool = resp.powerLevel || 9000;
$scope.lame = resp.coolLevel || 9;
});
var service = {}
service.getCool = function(id) {
if (localStorage.get('cool_kid_' + id)) {
return localStorage.get('cool_kid_' + id);
else {
return $http.get(/cool_guys/' + id).then(function(resp) {
localStorage.set('cool_kid_' + id, resp);
return angular.fromJson(resp);
});
}
});
service.getCoolCac = function(id) {
return $http.get(/cool_guys/' + id).then(function(resp) {
return angular.fromJson(resp);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment