My html call to this component
<navbar [title]="'Recorridos'"
[hasNavbarItems]="true"
[itemsJsonFileName]="'recorrido-list-navbar-items.json'"
(btnActionClicked)="onBtnActionClicked($event)"
(btnFilterClicked)="onBtnFilterClicked($event)">
</navbar>
this is a dynamic component then in onBtnActionClicked($event) needs to redirect like
<a [routerLink]="['/parent/detail', detail.detailId]">{{detail.detailId}}</a>
but as you see this can't be added from html then in my component I could call the button click doing
onBtnActionClickedV(event) {
}
in that function how can I redirect like routerLink does??
Have you tried something like this....
onBtnActionClickedV(event) {
this.router.navigate(['/parent/detail']);
}
and make sure you import router i.e.
import { Router } from '@angular/router';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With