I have a problem trying to bind the id of a route parameter to a variable.
The following error appears on the console:
EXCEPTION: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 15 in [['/envio',{id:'{{text}}'}]] in AppComponent@3:11 ("
<h1>Angular 2 Boilerplate</h1>
<p>Hello World!</p>
<a [ERROR ->][routerLink]="['/envio',{id:'{{text}}'}]">Go</a>
"): AppComponent@3:11
The component that throws the exception:
import {Component} from 'angular2/core';
import {ROUTER_DIRECTIVES, RouteConfig, RouterLink} from "angular2/router";
import {EnvioIDComponent} from "./id.component";
@Component({
selector: 'my-app',
template: `
<h1>Angular 2 Boilerplate</h1>
<p>Hello World!</p>
<a [routerLink]="['/envio',{id:'{{text}}'}]">Go</a>
`,
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: '/home', name: 'Inicio', component: AppComponent, useAsDefault: true},
{path: '/envio/:id', name: 'EnvioID', component: EnvioIDComponent},
])
export class AppComponent {
text:string='fine';
}
Thanks in advance!!