In my service-factory I lookup up a large dataset - I want to persist it and check for its existence to avoid calling it again
问题 My service (factory) makes an API call and assigns response data to a variable: .factory('MedicationMatchingNamesFactory', ['$http', '$q', 'MedicationDisplayNamesFactory', function MedicationMatchingNamesFactory($http, $q, MedicationDisplayNamesFactory){ return { getMatchingNames: function(inputValue){ var matches = []; // I thought this may be set as null so I'm able to // differentiate it from the below array form (when exists) var allNames = null; MedicationDisplayNamesFactory