I have a list-group defined as a list of recipe-items. I'm using the child routing in order to display a description of the item whenever the user clicks on a list element. So far the click event and the routing are working but I want to mark the clicked item as active.
recipe-list.component.html
<app-recipe-item
*ngFor="let recipeEl of recipes; let i = index"
[recipe]="recipeEl"
[routerLink]="i"
style="cursor: pointer;"
>
</app-recipe-item>
In order to do it I'm trying to use the routerLinkActive directive within my nested RecipeItemComponent but it looks like the directive is out of scope for the nested component.
recipe-item.component.html
<div class="list-group">
<a
class="list-group-item list-group-item-action d-flex justify-content-between align-items-start"
routerLinkActive="active"
>
TO BE MARKED AS ACTIVE WHEN CLICKED
</a>
</div>
What am I missing? Even using a localRef it's impossible to retrieve its value in a nested component.