0

I'm having a bit of trouble finding some documentation as to how I can pass a binded property as a parameter in my routerLink.

<a [routerLink]="['/dashboards', {{ product.id }} ]'" class="dead-link">
    <div class="card-header">
        {{ product.programName }}
    </div>
    <div class="card-block">
        <h4 class="card-title product-name">{{ product.name }}</h4>
        <p class="card-text product-description">{{ product.description | TruncatePipe }}</p>
    </div>
    <div class="card-footer text-muted">
        Last Updated {{ product.modifiedDate | date: 'MMMM d, y' }}
    </div>
</a>

Is there a way to do this? I'm currently getting the following error:

EXCEPTION: Error: Uncaught (in promise): Template parse errors:
Lexer Error: Unterminated quote at column 31 in expression [['/dashboards', {product.id} ]'] ("<a [ERROR ->][routerLink]="['/dashboards', {product.id} ]'" class="dead-link">
    <div class="card-header">

Thank you all!

Matthew Meppiel
  • 966
  • 3
  • 14
  • 29

1 Answers1

2
<a [routerLink]="['/dashboards', {{ product.id }} ]'" class="dead-link">

you have extra ', and you don't need the "{{}}" around product.id

<a [routerLink]="['/dashboards', product.id ]'" class="dead-link">

Good Luck!

YairTawil
  • 3,961
  • 1
  • 22
  • 20