ng-select
ng-select copied to clipboard
Hiding/disabling selected items in the dropdown for multi select feature
Is there a was we can disable or hide(remove from the list) from the dropdown list incase its already selected. it its de selected then it will added again.
currently its in grey color and on clicking of the selected item (normally user try to select) it de select the item from the list. But some time user want not to see the selected item while selecting.
is there a way to do this for multi select
The simple way is to use CSS to do that.
So you should have something like that:
ng-select /deep/ select-dropdown .selected {
display: none
}
in my component i added below line which have ng-select
component but it did not work. I think you have added encapsulation: ViewEncapsulation.Native
and its not taking external css. But when I put the same below line in my style.scss
(I am using angular-cli) it work perfectly.
.selected {
display: none
}
I think you should allow others to add css to select component level
Maybe the css statement:
.selected {
display: none
}
is not specific enough? Have you tried the following as well?
ng-select select-dropdown .selected {
display: none
}
I have to place this css in my style.scss file rather inside the component scss file worked for me
// style.scss file in angular cli project
/*tags component inside of the ng-select and ng-select-dropdown*/
/*this is a fix for the ng-select component because they did not have viewencapsulation in there compoenent*/
select-dropdown {
.options {
ul {
li.selected {
display: none;
}
}
}
}