我希望在Angular 2中通过单击按钮来替换标签(label)和输入文本框(input),我知道需要使用某种ngIf,但我有点困惑如何实现。
HTML:
HTML:
<form>
<div class="information">
<label *ngIf="editMode">{{textValue}}</label>
<input *ngIf="editMode" [ngModel]="name">
<button (click)="editMode=true">Edit</button>
<button (click)="editMode=false">Save</button>
</div>
</form>