【发布时间】:2019-11-26 21:32:32
【问题描述】:
我正在尝试将第 4 行 (click)="runMatrix()" 调用的方法的文本结果添加到第 7 行的 ion-textarea 中。通常我会使用 ngModel,但在这种情况下我不能我正在使用 ngModel 来保存数据。
.html
<div *ngFor="let fromItem of importQuestions let i = index">
<ion-card>
<ion-card-content>
<div class="question_link" (click)="openMatrix()">
{{fromItem.Question}}
</div>
<ion-textarea auto-grow="true" id="fromItem.ID" name="{{fromItem.name}}" [(ngModel)]="fromItem.input""> </ion-textarea>
</ion-card-content>
</ion-card>
<ion-card>
<ion-card-content>
<div class="question">
{{fromItem.Question}}
</div>
<ion-select multiple="true" name="{{fromItem.name}}" [(ngModel)]="fromItem.input">
<ion-select-option *ngFor="let item of importQuestions[i].values" value="{{item.value}}">{{item.value}}</ion-select-option>
</ion-select>
</ion-card-content>
</ion-card>
</div>
(click)="runMatrix() 方法返回一个字符串
this.resultNumber
我没有包含该方法,因为它非常大。
运行该方法后,如何将 resultNumber 放入 ion-textarea 的输入文本区域?
【问题讨论】:
-
这个问题有点混乱,能不能简单点?
-
请问我的回答有帮助吗?
-
不抱歉。我可能问得不好。 runMatrix() 返回类似“some text here”的内容。我必须想办法把它放到 textarea 的输入字段中。我不能使用 index 或 ngModel,因为它们被用来提取和保存数据
-
你想像这样添加
"some string returned by runMatrix" -
是的,这就是我想要做的