[英]Creating Tabs and calling sub-components with Bulma and Angular 5
I want to create a navigation panel with tabs, I'm using Bulma, I'll show an example from the documentation. 我想创建一个带有标签的导航面板,我正在使用Bulma,我将展示文档中的示例。 I'm using routing for the navigation of the project, but from my Matches component, I want to call a subcomponent from each tab. 我正在使用路由进行项目导航,但是从我的Matches组件中,我想从每个选项卡调用一个子组件。
<div class="tabs">
<ul>
<li class="is-active"><a>Upcoming</a></li>
<li><a>Past</a></li>
</ul>
</div>
Working like this: From the matches component call a subcomponent app-upcoming and app-past 像这样工作:从“匹配”组件中调用子组件app-upcoming和app-past
<div class="upcoming">
<app-upcoming></app-upcoming>
</div>
<div class="past">
<app-past></app-past>
</div>
Use the router-outlet to specify where to display the route components: 使用路由器插座来指定显示路由组件的位置:
https://angular.io/tutorial/toh-pt5#add-routeroutlet https://angular.io/tutorial/toh-pt5#add-router插座
When you use a route component, like this from the documentation. 当您使用路线组件时,请参见文档中的内容。
import { HeroesComponent } from './heroes/heroes.component';
const routes: Routes = [
{ path: 'heroes', component: HeroesComponent }
];
The component will get loaded into the router-outlet when the path matches heroes. 当路径与英雄匹配时,该组件将被加载到路由器插座中。 I'd recommend reading the routing documentation and following it along. 我建议阅读路由文档并继续阅读。
It is super easy you just go with router. 只需使用路由器,超级简单。 Take a look of https://angular.io/guide/router . 看看https://angular.io/guide/router 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.