I have a sidebar where list of items are fetched from api and are displayed. When one of the item is selected from the side bar it goes to a page where another drop down is there and data of selected item is displayed on that drop down. But when i change the item from side bar, the page where data of selected item should come, does not refreshed.
my side bar component.html
<li class="nav-item" *ngFor="let data of getItemList">
<a href="javascript:void(0)"
class="nav-link text-white p-3 sidebar-link"
(click)="list(data.Id)">
<i class="fa fa-clipboard"></i>{{data.ItemName}}</a>
</li>
my sidebar.component.ts
list(id) {
this.router.navigate(["/dashboard/item/item-home/" + id]);
}
my item-home.component.html
<select
type="number"
class="form-control"
(change)="onChangeItemData$event.target.value)"
formControlName="GroupId"
>
<option hidden value="" disabled="true"
>Please select Item data
</option>
<option
*ngFor="let group of itemInfo"
type="number"
[ngValue]="group.Id"
>
{{ group.Name }}
</option>
</select>
my item-home.component.ts
ngOnInit(): void {
this.route.paramMap.subscribe(
(routeParam) => {
const id = parseInt(routeParam.get("id"));
this.itemId = id;
},
(err) => { }
);
this.fetchGroupInfoByUseCases(this.itemId)
}
fetchGroupInfoByUseCases(Id) {
this.usecaseServ
.getGroupInfoByUseCase(Id)
.subscribe((res: any) => {
console.log(res);
this.groupInfo = res;
});
}
this.fetchGroupInfoByUseCases(this.itemId)in route param subscription block