Javascript 使用导航菜单2设置路线
我有一个选项卡菜单,我在app.module.ts中设置了我的路线,但我不知道如何在我的选项卡和路线之间建立适当的桥梁 这是我的html标签:Javascript 使用导航菜单2设置路线,javascript,angularjs,Javascript,Angularjs,我有一个选项卡菜单,我在app.module.ts中设置了我的路线,但我不知道如何在我的选项卡和路线之间建立适当的桥梁 这是我的html标签: <tabs> <tab [tabTitle]="'Home Page'"> </tab> <tab tabTitle="Feedback"> </tab> <tab tabTitle="Background"> </tab> <
<tabs>
<tab [tabTitle]="'Home Page'">
</tab>
<tab tabTitle="Feedback"> </tab>
<tab tabTitle="Background"> </tab>
<tab tabTitle="What we do"> </tab>
</tabs>
我需要采取哪些步骤将选项卡链接到正确的路由链接 遵循本页中的示例 这里 ante路由器将如下所示
{
path: 'components',
component: ComponentSidenav,
children: [
{path: 'components/:id', component: ComponentViewer},
],
},
请注意,该组件的父组件和子组件具有绝对路径,它将在您的选项卡中工作,您需要提供lcick上的链接,它将在路由器出口中显示舔过的组件 确保在index.html中添加标记
,以便路由组件将加载到那里
下面是您的选项卡导航
<tabs>
<tab [tabTitle]="'Home Page'">
</tab>
<tab tabTitle="Feedback"><a [routerLink]="['./app/homepage/homepage.component.html]"
routerLinkActive="css-class-for-active-link">
Home
</a></tab>
<tab tabTitle="Background"> </tab>
<tab tabTitle="What we do"> </tab>
</tabs>
家
然后单击Home链接,它将加载
标记内的Home组件
[routerLink]="['/components/component/', component.id]"
{
path: 'components',
component: ComponentSidenav,
children: [
{path: 'components/:id', component: ComponentViewer},
],
},
<tabs>
<tab [tabTitle]="'Home Page'">
</tab>
<tab tabTitle="Feedback"><a [routerLink]="['./app/homepage/homepage.component.html]"
routerLinkActive="css-class-for-active-link">
Home
</a></tab>
<tab tabTitle="Background"> </tab>
<tab tabTitle="What we do"> </tab>
</tabs>