I am working on a component that includes multiple routes such as home, app, and navbar.
My goal is to have the encrementcalc()
function execute when the navbar button is pressed. I attempted to use the event emitter but was unsuccessful. Can someone provide guidance on how to implement this?
Your help would be greatly appreciated.
For more details, please refer to the example provided here
Here's the code snippet:
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
</div>
<ul class="nav navbar-nav pull-right">
<li routerLinkActive="active"><a [routerLink]="['/home']">home</a></li>
<li routerLinkActive="active"><a [routerLink]="['/navbar']">navbar</a></li>
</ul>
</div>
</nav>
<router-outlet></router-outlet>
</div>