如何生成材料步进器?
我收到一个 JSON 文件,我需要从中生成步进器。使用时我根本无法显示任何内容[innerHTML]
这是我要实现的目标的示例:
<mat-vertical-stepper [linear]="false">
<mat-step [completed]="true" state="done">
<ng-template matStepLabel>Job name here</ng-template>
<p>this is test 1</p>
</mat-step>
<mat-step [completed]="true" state="done">
<ng-template matStepLabel>Job name here</ng-template>
<p>this is test 2</p>
</mat-step>
<ng-template matStepperIcon="edit">
<mat-icon>work</mat-icon>
</ng-template>
<ng-template matStepperIcon="done">
<mat-icon>work</mat-icon>
</ng-template>
</mat-vertical-stepper>
事实上,当我尝试使用[innerHTML]
这种方式时,它工作得很好:
<mat-vertical-stepper [linear]="false">
<span [innerHTML]="experienceDisplay">
</span>
<ng-template matStepperIcon="edit">
<mat-icon>work</mat-icon>
</ng-template>
<ng-template matStepperIcon="done">
<mat-icon>work</mat-icon>
</ng-template>
</mat-vertical-stepper>
我根本无法显示任何东西。即使我设置experienceDisplay
为与删除的 HTML 完全一样。在 Firefox / Chrome 中查看检查器表明根本没有代码。
如何让我的代码显示?
PS:我对使用表单不感兴趣,我在尝试显示大量信息时使用步进器的可折叠属性。女巫是为什么状态设置为done
并且[completed]
变量始终设置为true