i want to pass the id of a select value to another unrelated component
component 1 :
Html
<select (change)="getSelectedStoreId($event.target.value)">
<option *ngFor="let store of stores.slice().reverse()" value="{{store.id}}">
{{store.name}}
</option>
</select>
Ts
storeId: any;
getSelectedStoreId(store: any) {
this.storeId = store;
}
Component 2:
loadItemByStore(storeId: number) {
this.service.getItemByStore(storeId).subscribe((res:
HttpResponse<Item[]>) => {
this.data= res.body || [];
});
}