テンプレートのクラスにバインドされたデータから routerLink をバインドしようとしています。angular.io docs によると、テンプレートの構文は正しいようです。アプリケーションとコンポーネントの両方のレベルで ROUTER_PROVIDERS と ROUTER_BINDINGS (どちらも謎のまま) を試してみましたが、役に立ちませんでした。私のコードは「helpfull」エラーをスローします:TypeError: linkParams.reduce is not a function in [[ 'ClassDetail', {id: class._id} ] in ]
テンプレート:
<div class="container" >
<div class="row">
<div class="col-md-4 block" *ngFor="#class of classes | async">
<h2>{{class.title}}</h2>
<p>{{class.description}}</p>
<p><a class="btn btn-default" routerLink="[ 'ClassDetail', {id: class._id} ]" role="button">View details »</a></p>
</div>
</div>
</div>
routerLink がなければ、これはうまくレンダリングされます。
ルート構成:
@RouteConfig([
{ path: '/', component: Home, name: 'Index' },
{ path: '/home', component: Home, name: 'Home' },
{ path: '/about', component: AboutComponent, name: 'About' },
{ path: '/classes/:id', component: ClassDetailComponent, name: 'ClassDetail'}
])