I already checked the related question router.navigate changes the URL, but is not rendering the component but that same scenario is causing the same result.
I have a route in my routes module:
{
path: "competition/details",
loadChildren: "../pages/competitions/competitions-details/competitions-details.module#CompetitionsDetailsModule"
}
That page ("competition-details") renders my element:
<standings-regular></standings-regular>
Then in the component I check for 2 optional params:
this.competitionId = this.activatedRoute.snapshot.params.competition;
this.condition = this.activatedRoute.snapshot.params.condition;
And finally I use those params "competition" and "condition" to build an array. So far everything works if I use the URL directly in the browser:
e.g.: http://localhost:4200/competition/details;competition=219;condition=home
Now, this basically represents different views of the same table for a given competition, for a little context.
http://localhost:4200/competition/details;competition=219;condition=home
will render standings table with only home matches for each team from competition 219.
http://localhost:4200/competition/details;competition=219
creates the table with all matches from competition 219.
So, I would like to have a link within the same table to navigate to the new URL but when I try to do that It only changes the URL in the browser but does not change the view.
Here is how I'm trying to navigate:
<ul class="dropdown-menu btn-primary dropdown-menu-right">
<li>
<a md-ripple [routerLink]="['/competition/details', {competition: '219'}]">Completa</a>
</li>
<li>
<a md-ripple [routerLink]="['/competition/details', {competition: '219', condition: 'home'}]">Home Only</a>
</li>
</ul>
I've also tried replacing routerLink here with a (click)="" event that triggers a method in the component to navigate but the result was the same, change the URL in the browser, but does not do anything.
I tried both router.navigate() and router.navigateByUrl()
Any thoughts?