angular - 为什么 StackBlitz 中没有显示 mat-accordion?
问题描述
我正在开发一个测验应用程序,当您单击“查看详细摘要”链接时,带有问题和答案摘要的实际 mat-accordion 似乎没有显示在我的 ResultsComponent 中的 StackBlitz 中。仅显示展开/折叠按钮。请在此处查看我的 StackBlitz:https ://stackblitz.com/edit/angular-9-quiz-app
解决方案
你有结果
*ngFor="let panel of accordionList; let question of quizData.questions; index as i"
您不能使用 *ngFor 的这种类型(此外,accordionList 什么都不是)
必须是(我想)
*ngFor="let question of quizData.questions; index as i"
*更新了下面还有一个错误,你有
*ngFor="let finalAnswer of finalAnswers;
let correctAnswer of correctAnswers"
如果你想拥有两个 *ngFor 使用一个,你就无法做到这一点<ng-container>
<div *ngFor="let finalAnswer of finalAnswers">
<ng-container *ngFor="let correctAndser of correctAnswers>
...
</ng-container>
</div>
或者如果两个数组的长度相同,则使用索引
<div *ngFor="let finalAnswer of finalAnswers;let i=index">
{{correctAnswers[i]}}
</div>
推荐阅读
- haskell - 未能捕获“纯”函数引发的异常
- python - 如何组织已下订单
- matlab - Matlab 颜色图和 caxis 匹配非线性图
- amazon-web-services - 监控从 Glacier 到标准存储的批量转换?
- angular - 如何使用基于 webpack 的设置在 Angular 应用程序中加载外部库
- javascript - 为什么我应该调用 Function.prototype.apply.call(x, ...) 而不是 x.apply(...)?
- sql - 如何从 db 变量名中获取表名?(SQL)
- sql - 单个 where ... like 子句中的多行
- amazon-web-services - 在 AWS 状态语言中组合 `InputPath` 和 `Parameters`
- excel - Excel:以 KB、MB、GB、TB 等为单位更改单位大小的动态公式...自动