angular - 在 Angular 中随时随地编辑标题(mat-expansion-panel-header)
问题描述
我想在现场更改我的标题
这是我当前的图像看起来像
HTML 代码
<ng-container *ngFor="let group of formData.groups">
<!-- Panels-->
<mat-accordion>
<mat-expansion-panel cdkDrag>
<mat-expansion-panel-header>
{{group.formGroupName}}
</mat-expansion-panel-header>
</mat-accordion>
</ng-container>
我尝试添加如下输入,以便在应用程序上线时修改面板文本
<input type="text" [(ngModel)]="group.formGroupName" class="editable" />
但这不起作用
这是我的T。
formData: Form = {
formGroupName: 'form',
groups: [
{
formGroupName: 'personalDetails',
fields: [
{
formControlName: 'firstName',
type: 'Text',
required: false,
label:'FirstName',
locked: true
}
]
},
{
formGroupName: 'contactDetails',
fields: [
{
formControlName: 'address1',
type: 'Text',
required: false,
label:'Address 1',
locked: true
}
]
}
]
解决方案
最后我得到了解决方案。
<input type="text" [(ngModel)]="group.formGroupName" [value]="group.formGroupName" class="editable" />
推荐阅读
- react-native - React native redux 能够读取值但无法在同一页面中更新值
- node.js - 无法使用无服务器框架在 AWS Lambda 中部署 Node.js 应用程序
- java - TreeMap 放置了 100 个元素(每个元素 1MB),而堆只有 80 MB 内存,这种情况下的行为?
- c++ - 如何修复 Cling 和 LLVM Cmake 包含的即时段错误?
- php - 如何使rest api在react js中显示数据
- mongodb - 更新数组中的最后一个对象
- c# - 带有 C# 的 Mongo DB - 无论事务如何都添加文档
- mongodb - 入口点命令如何在这里工作
- html - 如何以三种不同的方式对齐弹性项目?
- docker - docker-compose 在不运行命令的情况下启动/启动