在Angular应用程序中显示2个工具条的问题

问题描述 投票:0回答:1

我有一个Angular项目,其中有两个工具栏:第一个是整个应用程序的固定工具栏。我把这段代码放在一个组件的工具条里面。

<-- toolbar.component.css-->  
mat-toolbar {
  position: fixed;
  justify-content: space-between;
  align-items: center;
  top: 0;
  z-index: 1000;
}

<--toolbar.component.html-->
<mat-toolbar>
   ...
</mat-toolbar>

第二个工具条在另一个组件里面。

<--component.css-->
mat-toolbar {
  position: relative;
  justify-content: space-between;
  align-items: center;
}

<--component.html-->
<mat-toolbar color="primary">
   ...
</mat-toolbar>

我的问题是第二个工具条没有被渲染出来 第二个工具条应该在固定工具条之后被渲染出来

我在app.component.html中调用了这两个组件。

谁能帮我解决这个问题?

angular angular-material toolbar
1个回答
0
投票

在浏览器中检查你的开发者控制台。如果它有一些错误,它可能没有渲染。同时检查你的第二个组件中是否有任何*ngIf或隐藏。如果一切都很完美,那么检查元素并检查该组件是否被加载。

© www.soinside.com 2019 - 2024. All rights reserved.