![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ngx-mat-select
Advanced tools
This library was generated for Angular Material to improve select component (mat-select)
This library was generated for Angular Material to improve select component (mat-select). In this library, I defined a directive for which generate Search box and Mobile View.
Extra Features, after use this directive:
RLT support (use dir='rtl' in html tag)
Compatible with Angular SSR (Universal)
The first step is adding ngx-mat-select.styles in angular.json
"styles": [
"./node_modules/ngx-mat-select/styles/ngx-mat-select.styles.css"
],
The second step is adding NgxMatSelectModule into your Module
import {MatSelectModule} from "@angular/material/select";
import {NgxMatSelectModule} from "ngx-mat-select";
...
@NgModule({
imports: [
...
MatSelectModule,
NgxMatSelectModule
...
]
})
you can define global default configs for root:
NgxMatSelectModule.forRoot({
emptyLabel: 'No results found';
placeholder: 'Search ...';
maximumResultForShow: 25;
valueMember: 'key';
displayMember:'value';
maxWidthForMobileView: 450;
useMobileView: true;
mobileViewType: 'FullScreen';
})
Client Side Search And Single Select with BottomSheet View In Mobile
html Template:
<mat-form-field>
<mat-select
ngxMatSelect
[hasSearchBox]="true"
[useMobileView]="true"
mobileViewType="BottomSheet"
[(ngModel)]="bankValue"
[multiple]="false"
name="bank"
[required]="true"
[source]="source"
[displayMember]="'value'"
[valueMember]="'key'"
#sf="ngxMatSelect"
>
<mat-option [value]="option" *ngFor="let option of sf.filteredSource">
{{option.value}}
</mat-option>
</mat-select>
</mat-form-field>
MyComponent.ts:
export class MyComponent implements OnInit {
bankValue = {key: 50, value: 'Bank_50'};
source: any[] = [];
ngOnInit(): void {
for (let i = 0; i < 100; i++) {
this.source.push({value: 'Bank_' + i, key: i})
}
}
}
Client Side Search And Multi Select with FullScreen View In Mobile
html Template:
<mat-form-field>
<mat-select
ngxMatSelect
[hasSearchBox]="true"
[useMobileView]="true"
mobileViewType="FullScreen"
[(ngModel)]="bankValue"
[multiple]="true"
name="bank"
[required]="true"
[source]="source"
[displayMember]="'value'"
[valueMember]="'key'"
#sf="ngxMatSelect"
>
<mat-option [value]="option" *ngFor="let option of sf.filteredSource">
{{option.value}}
</mat-option>
</mat-select>
</mat-form-field>
MyComponent.ts:
export class MyComponent implements OnInit {
bankValue = [{key: 10, value: 'Bank_10'},{key: 75, value: 'Bank_75'}];
source: any[] = [];
ngOnInit(): void {
for (let i = 0; i < 100; i++) {
this.source.push({value: 'Bank_' + i, key: i})
}
}
}
Server Side Search And Multi Select with FullScreen View In Mobile Template:
<mat-form-field>
<mat-select
ngxMatSelect
[lazyLoad]="true"
[searcher]="bankSearcher"
[hasSearchBox]="true"
[useMobileView]="true"
mobileViewType="FullScreen"
[(ngModel)]="bankValue"
[multiple]="true"
name="bank"
[required]="true"
[source]="source"
[displayMember]="'value'"
[valueMember]="'key'"
#sf="ngxMatSelect"
>
<mat-option [value]="option" *ngFor="let option of sf.filteredSource">
{{option.value}}
</mat-option>
</mat-select>
</mat-form-field>
MyComponent.ts:
import {Observable} from "rxjs";
import {of} from 'rxjs';
export class MyComponent implements OnInit {
bankValue = [{key: 10, value: 'Bank_10'},{key: 75, value: 'Bank_75'}];
source: any[] = [];
ngOnInit(): void {
for (let i = 0; i < 100; i++) {
this.source.push({value: 'Bank_' + i, key: i})
}
}
// server side mock search by 'of Observable'
bankSearcher = (search: string): Observable<any[]> => {
return of(this.kvSource.filter(w => w.value.includes(search)));
}
}
Property | Default Value | Options | Description |
---|---|---|---|
emptyLabel | No results found | string | label for no result found after search |
placeholder | Search ... | string | placeholder for search box |
maximumResultForShow | 30 | number | For better performance (especially in mobile), you must set maximum record for showing the records |
valueMember | id | string | when your value is an object, it must be defined |
displayMember | name | string | for searching, it must be defined |
maxWidthForMobileView | 599.9 | number | unit is px |
useMobileView | true | boolean | if this value is true and your screen width is less than value of maxWidthForMobileView, 'mat-select' Will be displayed in 'FullScreen' or 'Bottom Sheet' |
mobileViewType | 'FullScreen' | 'BottomSheet' | string | |
lazyLoad | false | boolean | for use searcher function, it must be true |
source | [] | any[] | Initial source(it can be big data) |
filteredSource | [] | any[] | filtered data(you receive filtered records from 'NgxMatSelect' directive) |
searcher | (search: string) => Observable<[]> | Function | for use lazy load you must define function that return ObserverOfArray |
hasSearchBox | true | boolean | |
title | null | string |
FAQs
It is an independent component like mat-select and a solution for handling SearchBox, VirtualScroll and InfiniteScroll which the Angular material select-box does not support them by it-self.
The npm package ngx-mat-select receives a total of 49 weekly downloads. As such, ngx-mat-select popularity was classified as not popular.
We found that ngx-mat-select demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.