Reputation: 306
I used ng-select option menu but i want to disable or remove it's close button how to do this. here i used code `
<ng-select id="CompanyID" [(ngModel)]="CompanyId" placeholder="-- select an option --">
<ng-option disabled selected value> -- select an option -- </ng-option>
<ng-option *ngFor="let company of Company" [value]="company.Company_ID" [disabled]="true">{{company.Name}}</ng-option>
</ng-select>`
Upvotes: 1
Views: 17292
Reputation: 4294
<ng-select [clearable]="false">
</ng-select>
Just add the attribute [clearable]="false"
Upvotes: 2
Reputation: 1028
Best way is to use [clearable]="false"
so that you don't have to use css.
<ng-select [clearable]="false">
</ng-select>
Upvotes: 10
Reputation: 3328
How I would do is, create a CSS class called no-clear -
.no-clear.ng-select .ng-clear-wrapper {
display: none;
}
Then use that class in your ng-select template,
<ng-select class="no-clear"
[items]="youtData"
[(ngModel)]="yourModel">
</ng-select>
Or you can also use [clearable]="false"
directive.
Upvotes: 3