Comments (1)
@barigo the reason it's not working, is that the selected value might not have been loaded as part of the limit and as such, will not be picket up by.
i got around this by injecting a static mat-option at the top of the list to appear as the selected option, and the rest of the infinite scroll following that. i don't have an example at hand at the moment, but it is pretty simple to implement, something like this:
public hasDefault = false;
// somewhere where you get the default value, set the hasDefault flag to true.
this.hasDefault = this.data.item; // as an example, this.data.item contains the item I'm passing to a modal
then in the HTML you can do something like this:
<mat-option *ngIf="hasDefault" [value]="defaultItem.id">{{ defaultItem.caption }}</mat-option>
seeing that the option is now visible to the engine, it'll select that as the default until the value is changed
note, this is just a rough example and can be updated to fit your scenario. hope this helps.
from ng-mat-select-infinite-scroll.
Related Issues (20)
- Can I prevent auto scroll top? HOT 3
- is it posssible to add search functionality with select HOT 6
- Angular 10 support HOT 2
- Support for MatAutocomplete HOT 1
- Scroll "stuck" after selecting the last element, multiple times
- Is it possible to avoid the 'scroll up' when scrolling down on limit of infinite scroll? HOT 1
- Angular and material 11 support. HOT 8
- Losing selection of lazy loaded items
- Update to the latest version
- missing exported member when building application HOT 5
- Add a license? HOT 2
- Infinite scroll not working when mat-option is added inside of a div element
- Hi,
- Angular 15 compatibility with new and legacy components HOT 4
- Has anyone faced a concurrency problem with the same http call?
- Angular 16 support HOT 5
- version 4.0.0 doesn't work with Angular 12.
- Will there be support for Angular 9? HOT 2
- Reload don't trigger if first selected element is the last of the first batch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-mat-select-infinite-scroll.