如何将文本字段更改为角度4中的输入元素

时间:2017-08-25 07:44:36

标签: javascript angular

My Html

我想实现单击编辑按钮来更改我输入的所有字段, 这是我的HTML



<div class="col-md-3">
  <div class="add-details">
    <span>LemonCandy, #78, IG Circle,</span>
    <span>JP Nagar Phase 1, Bangalore</span>
    <span>Karnataka, 560078</span>
  </div>
</div>
<div class="col-md-2">
  <div class="id-details">
    <span>info@lemoncanday.in</span>
    <span>skipper@lemoncanday.in</span>
    <span><a (click)="editDetails()" title="Edit Details">Edit Details</a></span>
  </div>
</div>
<div class="col-md-2"></div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

使用输入而不是span并根据标志禁用它。如果需要,可以执行一些CSS tweek来更改文本框视图,例如span

<div class="col-md-3"><div class="add-details"><input type="text" [disabled]={{typeflag}}>LemonCandy, #78, IG Circle,</input><input type="text" [disabled]={{typeflag}}>JP Nagar Phase 1, Bangalore</input><input type="text" [disabled]={{typeflag}}>Karnataka, 560078</input></div></div><div class="col-md-2"><div class="id-details">
<input type="text" [disabled]={{typeflag}}>info@lemoncanday.in</input><input type="text" [disabled]={{typeflag}}>skipper@lemoncanday.in</input><input type="text" [disabled]={{typeflag}}><a (click)="editDetails()" title="Edit Details">Edit Details</a></input></div>