我想找到Angular 2内联编辑的示例或指针。我在Angular 1中找到了一些非常好的示例,例如Inline edit demo (angular 1.0)。但是我正在努力寻找类似于Angular 2的示例。我基本上需要达到类似于此示例中的结果。当谈到Angular 2(1或2)时,我是一个完全新手,所以任何帮助都非常感激。* ngFor循环内的Angular 2内联编辑
我已经包括了我的Html,并且这个想法是,当按钮被点击时,userEditing标志被设置为true,但我只希望选择的行改变为Input元素而不是当前正在发生的所有行ngfor
<tr *ngFor='let user of userList'>
<td>
<input type="checkbox" [(ngModel)]="user.state">
</td>
<td>
{{user.userId}}
</td>
<td>
<input id="userName" type="text" class="form-control" ng-model="user.userName" *ngIf="userEditing" />
<span *ngIf="!userEditing"> {{user.userName}}</span>
</td>
<td>
<input type="text" class="form-control" ng-model="user.firstName" *ngIf="userEditing" />
<span *ngIf="!userEditing"> {{user.firstName}}</span>
</td>
<td>
<input type="text" class="form-control" ng-model="user.lastName" *ngIf="userEditing" />
<span *ngIf="!userEditing"> {{user.lastName}}</span>
</td>
<td>
<input type="text" class="form-control" ng-model="user.department" *ngIf="userEditing" />
<span *ngIf="!userEditing"> {{user.department}}</span>
</td>
<td> <button type="button" [ngClass]="{disabled : !enableButton}" class="btn btn-default" (click)="getUserToEdit($event, user.userId)">{{editUserButtonCaption}}</button>
<td> <button type="button" class="btn btn-default" (click)="deleteUser(user.userId)">{{deleteUserButtonCaption}}</button></tr>
<tr>
现在正在为此解决此问题。 – Zze