code: function fetchResults(searchText) {
        var items = $scope.$parent.$eval(self.remoteMethod),
          isList = angular.isArray(items),
          isPromise = items ? !!items.then : false; // Every promise should contain a `then` property
  
        if (isList) onResultsRetrieved(items);
        else if (isPromise) handleAsyncResults(items);
  
        function handleAsyncResults(items) {
          if (!items) return;
  
          items = $q.when(items);
          setLoading(true);
          items.then(onResultsRetrieved);
        }
  
        function onResultsRetrieved(matches) {
  
          // Just cache the results if the request is now outdated.
          // The request becomes outdated, when the new searchText has changed during the result fetching.
          if ((searchText || '') !== (self.searchText || '')) {
            return;
          }
  
          handleResults(matches);
        }
      }
docs: Fetches the results for the provided search text.
  @param searchText