mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00

Using just routerLinkActive doesn't work on first load, the query parameter might not be defined. Adding 'active' to the class attribute doesn't work either, it doesn't get removed after switching to the other view.
20 lines
796 B
HTML
20 lines
796 B
HTML
<div class="btn-group" data-toggle="buttons">
|
|
<a routerLink="."
|
|
[queryParams]="{view: 'list'}"
|
|
queryParamsHandling="merge"
|
|
(click)="switchViewTo(viewModeEnum.List)"
|
|
routerLinkActive="active"
|
|
[class.active]="currentMode === viewModeEnum.List"
|
|
class="btn btn-secondary">
|
|
<i class="fa fa-list" title="{{'search.view-switch.show-list' | translate}}"></i>
|
|
</a>
|
|
<a routerLink="."
|
|
[queryParams]="{view: 'grid'}"
|
|
queryParamsHandling="merge"
|
|
(click)="switchViewTo(viewModeEnum.Grid)"
|
|
routerLinkActive="active"
|
|
[class.active]="currentMode !== viewModeEnum.List"
|
|
class="btn btn-secondary">
|
|
<i class="fa fa-th-large" title="{{'search.view-switch.show-grid' | translate}}"></i>
|
|
</a>
|
|
</div> |