angular - Issue with routerLink directive -


i'm writing angular2 app includes routing component router.

as of today, i'm using angular-2.0.0-beta.3.

while in child component, try use routerlink directive following template:

<a [routerlink]=['/home']>go home</a>.

instead, what's getting rendered is:

<a>go home</a>

with no exception thrown whatsoever, leaving invalid anchor.

it's important note router.navigate(['home']) working expected.

app.component.ts:

@component({     selector: 'app',     providers: [wrapperservice],     template: '<router-outlet></router-outlet>',     directives: [router_directives] })    @routeconfig([     { path: '/home', as: 'home', component: homecomponent, useasdefault: true } ]) export class appcomponent {     constructor() { } } 

home.component.ts

@component({     selector: 'home',     template: '<a [routerlink]="['/home']">go home</a>',     directives: [router_directives] }) export class homecomponent {     constructor() { } } 

actually, these files should show working link to...the current page (for simplicity).

what missing here?

the as syntax using deprecated while , renamed name

here how define routes.

 @routeconfig([    new route({ path: '/spreadsheet', component: spreadsheet, name: 'spreadsheet' })  ])  <a [routerlink]="['/spreadsheet']">virtualized spreadsheet</a> 

more info here: http://www.syntaxsuccess.com/viewarticle/routing-in-angular-2.0


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -