나는이 component.html이 : 기본적으로각도 2 *에 대한 ngIf '이'코너 2에서
editAction(){ this.iscalled = true; }
은이 component.ts와
<li *ngFor="let something of somethings">
<span>{{something}}</span>
<input class="doit" type="text" *ngIf="iscalled" />
<div id="container">
<button class="btn btn-warning editsection (click)="editAction()">Edit</button>
</div>
</li>
을 내 구성 요소에서 false로 설정하십시오.
기본적으로 각 something
은 somethings
입니다. 내 목록과 함께 입력란에는 할당 된 입력란과 editAction()
을 실행하는 버튼이 있습니다. 사용자가 editAction()
버튼을 클릭하면 버튼이 나타납니다.
이제는 editAction()
버튼을 클릭하면 내 목록의 모든 입력 필드가 활성화됩니다. 이 내용을 의미하는 정확히 li
요소로 제한하고 싶습니다.
각도 2에 특정 동작이 있는지, 아니면 일반 자바 스크립트 솔루션인지 알 수 없습니다.
ngFor가 노출하는 색인을 사용해 보셨습니까? – jonrsharpe