javascript - 如何使输入更改 ngFor 项目值?
问题描述
例如,我有这个数组(从开发工具中的 Sources 选项卡获得)
bodyParams = [
0: {placeholder: "{{1}}"}
1: {placeholder: "{{2}}"}
2: {placeholder: "{{3}}"}
3: {placeholder: "{{4}}"}
4: {placeholder: "{{5}}"}
]
而这个 ngFor:
<div *ngFor="let item of bodyParams; let idx = index;">
<wds-input
[placeholder]="
('messages.generic.message_composer.template.sample_insert' | translate) + '{{' + (idx + 1) + '}\}'
"
></wds-input>
</div>
对于每个项目,ngFor 生成一个输入字段来填充..
但我不能让输入值更改数组占位符值来进行替换。
我尝试使用[(ngModel)]
但没有用。
解决方案
推荐阅读
- automated-tests - 您能否将结果(Given)保存到 Gherkin 特征文件中的变量中,然后将该变量与另一个结果(Then)进行比较?(Java 的黄瓜)
- python - 使用 PySide2 和 QTableView 如何使用 pandas 模型在表格视图中获得多个委托?
- docusignapi - DocuSign 向用户重新发送信封并进行主题更正
- parsing - 词法分析器和解析器的 ANTLR 令牌识别错误
- emacs - 如何在 emacs 的新垂直拆分窗口中创建 org-capture 打开缓冲区?
- java - 使用 SP24 for Eclipse 运行 Crystal 报表时出现 NullPointerException
- postgresql - 如何在 postresql 版本 12 中创建用户?
- unity3d - 我的 tilemap 的边界包括很多未使用的区域,每当我尝试擦除未使用的区域时,边界就会增长
- google-cloud-firestore - Firestore 安全规则:检查数组是否包含与用户 ID 不同的字符串
- arrays - postgres:使用交叉表或任何 json 函数构建选择查询