1
1
2
2
# Angular Material Select Infinite Scroll
3
-
4
- Adds missing infinite scroll functionality for the [ angular material select component] ( https://material.angular.io/components/select )
5
-
6
-
3
+
4
+ Adds missing infinite scroll functionality for the [ Angular Material Select component] ( https://material.angular.io/components/select ) .
5
+
7
6
### Inputs
8
-
9
- | Property | Description | Type | Default |
10
- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------| ---------- |
11
- | ` complete ` | If ` true ` , the ` infiniteScroll ` output will no longer be triggered | ` boolean ` | ` false ` |
12
- | ` threshold ` | The threshold distance from the bottom of the options list to call the ` infiniteScroll ` output event when scrolled. The threshold value can be either in percent, or in pixels. For example, use the value of ` 10% ` for the ` infiniteScroll ` output event to get called when the user has needs 10% to reach the bottom. | ` string ` | ` '15%' ` |
13
- | ` debounceTime ` | The threshold time before firing the ` infiniteScroll ` event | ` number ` | ` 150 ` |
14
- ### Outputs
15
- | Property | Description | Type |
16
- | ----------------- | --------------------------------------------------------------------------------------- | --------------------
17
- | ` infiniteScroll ` | Emitted when the scroller inside the ` mat-select ` reaches the required distance | ` EventEmitter<void> `
18
-
19
- ### Installation
20
7
21
- ```
8
+ | Property | Description | Type | Default |
9
+ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------| ---------- |
10
+ | ` complete ` | If ` true ` , the ` infiniteScroll ` output will no longer be triggered. | ` boolean ` | ` false ` |
11
+ | ` threshold ` | The threshold distance from the bottom of the options list to call the ` infiniteScroll ` output event when scrolled. The threshold value can be either in percent or pixels. For example, ` 10% ` triggers the event 10% before the bottom. | ` string ` | ` '15%' ` |
12
+ | ` debounceTime ` | The threshold time (in milliseconds) before firing the ` infiniteScroll ` event. | ` number ` | ` 150 ` |
13
+
14
+ ### Outputs
15
+
16
+ | Property | Description | Type |
17
+ | ----------------- | --------------------------------------------------------------------------------------- | --------------------- |
18
+ | ` infiniteScroll ` | Emitted when the scroller inside the ` mat-select ` reaches the required distance. | ` EventEmitter<void> ` |
19
+
20
+ ### Installation
21
+
22
+ ``` bash
22
23
npm i ng-mat-select-infinite-scroll
23
24
```
24
25
25
- ### Usage
26
- [ StackBlitz working example] ( https://stackblitz.com/edit/ng-mat-select-infinite-scroll )
26
+ ### Usage
27
+
28
+ [ StackBlitz working example] ( https://stackblitz.com/edit/ng-mat-select-infinite-scroll )
27
29
28
- Import ` MatSelectInfiniteScrollModule ` inside the app.module.ts
30
+ Import ` MatSelectInfiniteScrollModule ` inside the ` app.module.ts ` :
29
31
``` typescript
30
- import { MatFormFieldModule , MatSelectModule } from ' @angular/material/select' ;
31
- import {MatSelectInfiniteScrollModule } from ' ng-mat-select-infinite-scroll' ;
32
+ import { MatFormFieldModule } from ' @angular/material/form-field' ;
33
+ import { MatSelectModule } from ' @angular/material/select' ;
34
+ import { MatSelectInfiniteScrollModule } from ' ng-mat-select-infinite-scroll' ;
32
35
33
36
@NgModule ({
34
37
declarations: [
@@ -44,11 +47,10 @@ import {MatSelectInfiniteScrollModule} from 'ng-mat-select-infinite-scroll';
44
47
providers: [],
45
48
bootstrap: [AppComponent ]
46
49
})
47
- export class AppModule {
48
- }
50
+ export class AppModule {}
49
51
```
50
52
51
- Then place the msInfiniteScroll directive on the ` mat-select ` component
53
+ Then, place the ` msInfiniteScroll ` directive on the ` mat-select ` component:
52
54
``` html
53
55
<mat-form-field appearance =" outline" >
54
56
<mat-label >Select</mat-label >
@@ -58,28 +60,34 @@ Then place the msInfiniteScroll directive on the `mat-select` component
58
60
</mat-form-field >
59
61
```
60
62
61
- ### Compatibility
63
+ > ** Note:**
64
+ > Update the ` complete ` property when the loaded data reaches the total available data to avoid unnecessary scroll triggers.
65
+ > For older versions of Angular (<15), use version 4 of this library.
66
+
67
+ ### Compatibility
68
+
69
+ This library supports Angular 15 and higher.
70
+ * ` @angular/core ` : ` >=15.0.0 <16 `
71
+ * ` @angular/cdk ` : ` >=15.0.0 <16 `
72
+ * ` @angular/material ` : ` >=15.0.0 <16 `
73
+ * ` rxjs ` : ` ^7.0.0 `
62
74
63
- * ` @angular/core ` : ` >=6.0.0 <16 ` ,
64
- * ` @angular/cdk ` : ` >=6.0.0 <16 ` ,
65
- * ` @angular/material ` : ` >=6.0.0 <16 ` ,
66
- * ` rxjs ` : ` ^7.0.0 `
75
+ ### Contributions
67
76
68
- ### Contributions
69
- Contributions are welcomed, feel free to open a Pull-Request or open a new issue.
77
+ Contributions are welcome! Feel free to open a Pull Request or create a new issue.
70
78
71
- ### Development server
79
+ ### Development Server
72
80
73
- Run ` ng serve ` for a dev server. Navigate to ` http://localhost:4200/ ` . The app will automatically reload if you change any of the source files.
81
+ Run ` ng serve ` for a dev server. Navigate to ` http://localhost:4200/ ` . The app will automatically reload if you change any source files.
74
82
75
- ### Build
83
+ ### Build
76
84
77
- Run ` ng build ` to build the project. The build artifacts will be stored in the ` dist/ ` directory. Use the ` --prod ` flag for a production build.
85
+ Run ` ng build ` to build the project. The build artifacts will be stored in the ` dist/ ` directory. Use the ` --prod ` flag for a production build.
78
86
79
- ### Running unit tests
87
+ ### Running Unit Tests
80
88
81
- Run ` ng test ` to execute the unit tests via [ Karma] ( https://karma-runner.github.io ) .
89
+ Run ` ng test ` to execute unit tests via [ Karma] ( https://karma-runner.github.io ) .
82
90
83
- # License
91
+ ### License
84
92
85
- [ MIT] ( LICENSE )
93
+ [ MIT] ( LICENSE )
0 commit comments