我的链接
<a [routerLink]="['/login']">
<i class="glyphicon glyphicon-user"></i> Login
</a>
我的路线
const routes: Routes = [
{ path: 'login', component: LoginComponent },
{ path: 'register', component: UserRegisterComponent },
{ path: 'auctions', component: AuctionListComponent },
{ path: 'auction/:id', canActivate: [ AuctionDetailGuard ], component: AuctionDetailComponent },
{ path: 'supplier/:id', component: SupplierDetailComponent }
];
导航到拍卖的路由器链接,auction /:id和supplier /:id按预期工作,但登录和注册没有,当我点击其中任何一个导航到正确的组件时,URL会变为localhost:xxxx / login在返回localhost之前的一瞬间:xxxx / previousUrl
这是其他路由器链接,按预期工作
<a [routerLink]="['/auction', auction.id]">
{{category.name }} - {{auction.name}}
</a>
答案 0 :(得分:0)
您可以尝试登录并以下列方式注册:
<a routerLink="/login">
<i class="glyphicon glyphicon-user"></i> Login
</a>