On the below error . Am getting template parse error on RouterLink
.
What is the correct way to use the RouterLink
in Angular 2 ?
Unhandled Promise rejection: Template parse errors:Parser Error: Unexpected token / at column 2 in [[/events]] in ng:///t/e.html@30:46 ("r">
<ul class="nav nav-sidebar">
<li class="active"><a [ERROR ->][routerLink]="[/events]">Events</a></li>
<li><a [routerLink]="[/task"]>Tasks<"): ng:///t/e.html@30:46Parser Error: Unexpected token / at column 2 in [[/events]] in ng:///t/e.html@30:46 ("ebar"> <ul class="nav nav-sidebar">
<li class="active">[ERROR ->]<a [routerLink]="[/events]">Events</a></li>
<li><a [routerLink]="[/task"]>Tas"): ng:///t/e.html@30:43, Directive tParser Error: Unexpected token / at column 2 in [[/events]] in ng:///t/e.html@30:46 ("ebar">
<ul class="nav nav-sidebar">
You have syntax error, you're using:
<a [routerLink]="[/events]" ... >
but instead it should be:
<a [routerLink]="['/events']" ... >
or
<a routerLink="/events" ... >
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