nl_tokens: Handles changes to the selected item .
pl_tokens: 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 ) . <mask> ( 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 ( ) ; }