Reputation: 6003
This is My Folders UI and when I click or select any one folder i want to highlight that specific folder with green color and second question is i hover mouse on any other folder I want to highlight that folder with yellow color. each folder has its different folderid
<div *ngFor="let folder of folderObjs (dblclick)="addNewFolderRoute(folder.folderid)">
<mat-icon>folder</mat-icon>
<span>{{folder.folderName}}</span>
</div>
Upvotes: 1
Views: 3638
Reputation: 2290
Try this
<div *ngFor="let folder of folderObjs" (dblclick)="addNewFolderRoute(folder.folderid)" (click)="activeFolder=folder" class="folder" [class.green]="folder==activeFolder">
<mat-icon>folder</mat-icon>
<span>{{folder.folderName}}</span>
</div>
and css
.folder:hover {
background:yellow;
}
.folder.green {
background:green;
}
Upvotes: 4