Currently, I am developing an angular application. In this project, I have implemented a navbar with <a>
tagged links. My goal is to toggle a flag variable each time a link is clicked. This will allow me to hide the navbar and display another component.
While testing my site on Chrome, I noticed that I need to click a link twice for the toggle function to execute. Below is the HTML code snippet:
<div class="jumbotron jumbotron-fluid" style="padding-top:0" *ngIf="showFlag === true">
<nav class="navbar">
<ul class="navbar-nav" id="link-nav" style="width:30%">
<li class="nav-item">
<span>
<a class="nav-link" (click)="toggleComponent()">My Story</a>
<hr>
</span>
</li>
The above code snippet demonstrates my attempt at toggling the visibility of the jumbotron. One thing to consider is that the component named header
is nested within another component. I wonder if this nesting could be causing the double-click issue...
<div id="particles-js">
<app-header></app-header>
</div>
If anyone has any insights or suggestions to offer, please help me out. Thank you!