1
我试图重定向从一个网页到另一个使用routerlink和我试过下面的代码,如何在angular2中使用routerlink?
我必须为我的网址如下路线
http://localhost:3000/#/app/dashboard
我想重定向到这一点,当我点击这个
[routerLink]=" ['tables/basic'] "
http://localhost:3000/#/app/tables/basic
,但它会
http://localhost:3000/#/app/dashboard/tables/basic
这里应该删除仪表板,我该怎么做?任何人都可以提供一些帮助吗?
我routes.ts,
import { Routes } from '@angular/router';
import { ErrorComponent } from './error/error.component';
export const ROUTES: Routes = [{
path: '', redirectTo: 'app', pathMatch: 'full'
}, {
path: 'app', loadChildren:() => System.import('./layout/layout.module')
}, {
path: 'login', loadChildren:() => System.import('./login/login.module')
}, {
path: 'error', component: ErrorComponent
}, {
path: '**', component: ErrorComponent
}
];
手枪,编辑我的routes.ts – Arnold
你有没有试过我的建议? –
This one worked [routerLink] =“['/ app/tables/basic']” – Arnold