Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Forked from anonymous/example
Last active August 29, 2015 14:08
Show Gist options
  • Save dwelch2344/d88bfa673dbc913b6ce0 to your computer and use it in GitHub Desktop.
Save dwelch2344/d88bfa673dbc913b6ce0 to your computer and use it in GitHub Desktop.
var saved_options = {};
function getOptions(myOption){
if(saved_options[myOption]){
var deferred = $q.defer();
deferred.resolve(saved_options[myOption]);
return deferred.promise;
}else{
return $http({method: 'GET', url:'someUrl'}).then(function(data){
saved_options[myOption] = data.data;
return data.data;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment