首页 > 解决方案 > 在角度 8 中不使用 [(ngModel)] 更新 innerHTML 值

问题描述

I'm getting values dynamically like an array,

[
{"name":"Ram", "email":"Ram@gmail.com"},
{"name":"Bob", "email":"bob32@gmail.com"}
],

using textarea with HTMLtag I inserting the name value, when user click on textarea and if he wants to type some text and if he click on cancel button it should render to previous value.
condition: must not have to use [(ngModel)], we must not have to change anytags, Used keyup to detect change  


Not able to revert the change to previous value when user click cancel, must not have to add form as well

    

<div *ngFor="let emp of employees">
  <textare [innerHTML]="emp.name"></textarea>
</div>
<div>
  <button (click)="Reset()">Cancel </cancel>
</div>

标签: typescriptangular8

解决方案


推荐阅读