angular - 角度命名的路由器插座不显示组件
问题描述
我正在尝试component
在我的主路由器插座内的命名插座内显示一个。我有一个组件: ,其中calculateur.component.ts
有一个:button
router link
[routerLink]="['/',{ outlets: { resultats: 'synthese' } }]"
这是路由配置:
{
path: "indicateur",
component: IndicateurComponent,
children: [
{
path: "",
redirectTo: "absenteisme",
pathMatch: "prefix"
},
path: "calculateur",
component: CalculateurComponent,
children: [
{
path: "synthese",
component: SyntheseComponent,
outlet: "resultats"
},
{
path: "cout-direct",
component: CoutDirectComponent,
outlet: "resultats"
},
{
path: "cout-indirect",
component: CoutIndirectComponent,
outlet: "resultats"
}
]
},
当我点击它时,网址变成 : http://localhost:4200/#/indicateur/calculateur(resultats:synthese)
,但屏幕上什么也没有发生。
我不确定导致上述行为的问题。
解决方案
routerLink
应该在您的IndicateurComponent
模板上(您可能将其命名为indicateur.component.html
),而不是在CalculateurComponent
.
另外,请确保将您router-outlet
的IndicateurComponent
.
推荐阅读
- ssl - 在带有 Route53 DNS 的 EKS 上配置 LE 通配符证书
- cypress - Cypress mochawesome 报告:在执行生成 HTML 报告的命令时出现“找不到命令:marge”错误
- kotlin - 在 Kotlin 中取消转义并获取 Unicode 字符串
- angularjs - 在 app.module.ts 加载(Angular)之前调用函数以获取 JSON 对象
- listview - 如何将 ListView/CollectionView 的 DataTemplate 绑定到 ViewModel 属性
- python-3.x - python3 request.post 间歇性失败
- ros - ROS 和 Gazebo:加载关节控制器时的模型问题
- javascript - css 类名在 react-big-calendar 中的含义[与 Selenium 一起使用]
- r - 比较长度不等的数据帧列表
- opencv - 计算图像的时刻