路线
const appRoutes: Routes = [
{ path: '', redirectTo: '/companies/unionbank', pathMatch: 'full'},
{ path: 'companies/:bank', component: BanksComponent },
{ path: '**', redirectTo: '/companies/unionbank' }
]
零件
const NAVBAR = [
{
name: 'Banks',
submenu: [
{ routelink: '/companies/unionbank', name: 'Union Bank' },
{ routelink: '/companies/metrobank', name: 'Metro Bank' },
{ routelink: '/companies/bdo', name: 'BDO' },
{ routelink: '/companies/chinabank', name: 'China Bank' },
]
},
...
]
链接示例: http://localhost:8099/#/companies/bdo
我想 在上面的示例链接中获取String
bdo。
我知道我可以使用window.location.href并将其拆分为数组。因此,我可以获得最后一个参数,但我想知道是否有适当的方法以角度方式执行此操作。
任何帮助,将不胜感激。谢谢