0
我在查找一些文檔時遇到了一些問題,以瞭解如何將綁定屬性作爲參數傳遞給我的routerLink。Angular 2 - 如何將參數傳遞給綁定屬性的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>
有沒有辦法做到這一點?我目前收到以下錯誤:
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">
謝謝大家!