简体   繁体   English

如何使用 Angular 并排添加 2 个标题元素?

[英]How can I add 2 Title elements side by side using Angular?

In my project I am using <mat-expansion-panel> .在我的项目中,我使用的是<mat-expansion-panel> I am trying to add 2 title element using <mat-panel-title> side by side with their respective description我正在尝试使用<mat-panel-title>并排添加2 title element及其respective description

Currently my code displays目前我的代码显示

Title1 Title2 Description1 Description2

What I am looking for is我正在寻找的是

Title1 Description1 Title2 Description2

Here is my code - Link - https://stackblitz.com/edit/mat-expansion-panel-q1qxz7?file=app%2Fexpansion-overview-example.html这是我的代码 - 链接 - https://stackblitz.com/edit/mat-expansion-panel-q1qxz7?file=app%2Fexpansion-overview-example.html

<mat-nav-list>
  <mat-expansion-panel>
    <mat-expansion-panel-header>
      <mat-panel-title>
        Title 1 </mat-panel-title>
      <mat-panel-description>
        <dd class="col-sm-10 record_property_value" data-property-type="select">{{ 'Description fror Title 1'}}</dd>
      </mat-panel-description>
      <mat-panel-title>
        Title 2
      </mat-panel-title>
      <mat-panel-description>
        <dd class="col-sm-10 record_property_value" data-property-type="select">{{ 'Description fror Title 2'}}</dd>
      </mat-panel-description>
    </mat-expansion-panel-header>
  </mat-expansion-panel>
</mat-nav-list>

As per Angular material documentation, mat-expansion-panel-header should have a single <mat-panel-title> and an <mat-panel-description> for proper positioning of panel content.根据 Angular 材料文档, mat-expansion-panel-header应该有一个<mat-panel-title>和一个<mat-panel-description>以正确定位面板内容。 But in your case you can try this method...但是在您的情况下,您可以尝试这种方法...

I have edited your stackblitz here and it seems to be working.我在这里编辑了你的stackblitz ,它似乎正在工作。 Please verify..请验证..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM