-
-
Save dwelch2344/d88bfa673dbc913b6ce0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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