I have a problem... I created the following navbar:
.menu {
position: fixed;
height: 100vh;
width: 150px;
background-color: #3D5021;
z-index: 0;
left: 0px;
}
nav {
margin-top: 50px;
}
nav ul {
list-style: none;
text-align: center;
}
nav ul li {
display: block;
margin: 5px 0;
width: 60px;
height: 60px;
}
input[type="checkbox"] {
display: none;
}
.menuButtonIcon {
color: #FFFFFF60;
}
.menuButtonIcon .fas {
font-size: 25px;
}
nav ul li:hover i {
color: #FFFFFF;
cursor: pointer;
}
#btnDashboard:checked~.fa-tachometer-alt {
color: #FF8A00FF;
}
#btnList:checked~.fa-list-ul {
color: #FF8A00FF;
}
#btnHeatMap:checked~.fa-map {
color: #FF8A00FF;
}
.container {
position: absolute;
width: calc(100vw - 100px);
right: 0;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
background-color: #E1E1E1;
min-height: 100vh;
}
.normal-content {
margin-left: 50px;
margin-top: 20px;
}
.full-content {
margin: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div class="menu">
<nav>
<ul class="nav-links">
<div class="selector"></div>
<li>
<label for="btnDashboard" class="menuButtonIcon" routerLink="/researcher/dashboard">
<i class="fas fa-tachometer-alt"></i>
</label>
<input type="checkbox" id="btnDashboard" checked>
</li>
<li>
<label for="btnList" class="menuButtonIcon" routerLink="/researcher/list">
<i class="fas fa-list-ul"></i>
</label>
<input type="checkbox" id="btnList">
</li>
<li>
{{checked}}
<label for="btnHeatMap" class="menuButtonIcon" [(ngModel)]="checked">
<i class="fas fa-map"></i>
</label>
<input type="checkbox" id="btnHeatMap">
</li>
</ul>
</nav>
</div>
<div class="container">
<div id="content" class="normal-content">
<router-outlet></router-outlet>
</div>
</div>
Now when I run this code, the RouterLink mappings are working perfectly, because the content gets switched to the right page, but the colors of the icons in the navbar are not changing. I printed the checked property of the heatmap button, but that value stays always false. First I thought that the entire navbar gets reloaded when the Routerlink triggers, but when I turn that off, I still don't see any color changes... How can I change the color of the selected icon in the navbar???