hi
I want Load Data should display data on basis of First Value in Dropdown for the first time. Using Angular 17
Academic Class
@for (item of classList; track item.id) {
{{item.name}}
}
public loadData() {
this.exampleDatabase = new StudentsService(this.htpClient,this._generic);
this.dataSource = new ExampleDataSource( this.exampleDatabase,this.paginator, this.sort );
this.subs.sink = this.paginator.page.subscribe(() => {
this.exampleDatabase?.getAllRegisteredStudents(this.paginator.pageIndex, this.paginator.pageSize);
});
this.subs.sink = this.sort.sortChange.subscribe(() => {
this.exampleDatabase?.getAllRegisteredStudents(this.paginator.pageIndex, this.paginator.pageSize);
});
}
Thanks
Tuhin PaulPosted Jul 31, 2024, 5:05 PM
The component code with comments.
Jithu ThomasPosted Jul 29, 2024, 7:53 AM
To achieve the functionality where data is loaded based on the first value in the dropdown when the component is initialized, you need to set the initial value of the dropdown and then call the
loadData()function accordingly. Here’s how you can do it:academicClassIdform control.loadData()method based on the selected value.Here is the updated code with these changes: