code: function selectedItemChange (selectedItem, previousSelectedItem) {
  
      updateModelValidators();
  
      if (selectedItem) {
        getDisplayValue(selectedItem).then(function (val) {
          $scope.searchText = val;
          handleSelectedItemChange(selectedItem, previousSelectedItem);
        });
      } else if (previousSelectedItem && $scope.searchText) {
        getDisplayValue(previousSelectedItem).then(function(displayValue) {
          // Clear the searchText, when the selectedItem is set to null.
          // Do not clear the searchText, when the searchText isn't matching with the previous
          // selected item.
          if (angular.isString($scope.searchText)
            && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) {
            $scope.searchText = '';
          }
        });
      }
  
      if (selectedItem !== previousSelectedItem) announceItemChange();
    }
docs: Handles changes to the selected item.
  @param selectedItem
  @param previousSelectedItem