i have serious problem with angular 2 (RC1) router.
This code works:
<a [routerLink]="['/anythingEvenNotExistingRoute']"></a>
<router-outlet></router-outlet>
This doesn't:
//<a [routerLink]="['/anything']"></a> <-- without this line in html template
<router-outlet></router-outlet>
...so it looks like angular router needs atleast one routerLink in html template.. thats pretty strange..
This is currently a bug present in the Angular 2 RC Router https://github.com/angular/angular/issues/8409 .
As mentioned in the GitHub issue, to get around it you can either inject the router into AppComponent
or just put an empty router link ( <a [routerLink]="['/']"></a>
) into your template.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.