mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
from @art-lowel: set ngModel for select, and also selected attribute for options
That currentOptionId$ observable is then used in the template to set the ngModel for the select, which, as mentioned above, should have been enough to select the correct option, but as it wasn't I also use it to set the selected attribute on the options
This commit is contained in:
@@ -10,9 +10,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="d-block d-sm-none">
|
<div class="d-block d-sm-none">
|
||||||
|
|
||||||
<select name="browse-type" class="form-control" aria-label="Browse Community or Collection" (change)="onSelectChange(($event.target))">
|
<select name="browse-type"
|
||||||
|
class="form-control"
|
||||||
<option *ngFor="let option of allOptions" >{{ option.label | translate }}</option>
|
aria-label="Browse Community or Collection"
|
||||||
|
(ngModelChange)="onSelectChange($event)"
|
||||||
|
[ngModel]="currentOptionId$ | async">
|
||||||
|
<option *ngFor="let option of allOptions"
|
||||||
|
[ngValue]="option.id"
|
||||||
|
[attr.selected]="(currentOptionId$ | async) === option.id ? 'selected' : null">{{ option.label | translate }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
Reference in New Issue
Block a user