Skip to content

Commit

Permalink
refactor(select): use ng-select classes to add mat color
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbin committed May 17, 2024
1 parent 417e051 commit dd77e7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion projects/extensions/select/select.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ng-select #ngSelect
<ng-select #ngSelect class=""
[class.ng-select-invalid]="errorState"
[(ngModel)]="value"
[ngModelOptions]="{standalone: true}"
Expand Down
7 changes: 2 additions & 5 deletions projects/extensions/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,7 @@ export class MtxSelect
openChange() {
this.openEvent.emit();

// TODO: The ng-select has no `panelClass` prop, so we can add the theme color by the following way.
setTimeout(() => {
const dropdownEl = document.getElementById(this.ngSelect.dropdownId) as HTMLElement;
dropdownEl.classList.add('mat-' + this._parentFormField?.color);
});
// The ng-select has no `panelClass` prop, so we can add the theme color by the following way.
this.ngSelect.classes += ' mat-' + this._parentFormField?.color;
}
}

0 comments on commit dd77e7e

Please sign in to comment.