<div id="lists">
<table id='mytable' cellspacing='0' cellpadding='0'>
<tr class="row" [ngClass]="{'selected': i === selectedIndex}" *ngFor= 'let item of list; let i = index' [attr.data-index]='i' [ngStyle]="{'background-color': i%2 == '0' ? 'gray' : ''}">
<td class='default-field'>
<p class='para' *ngIf="selectedIndex!=i ">{{i+1}}. {{item}}</p>
</td>
<td class="edit-field" *ngIf="selectedIndex==i " >
<input type="text" class="myCl" [value]="val" >
</td>
<td class='btns'>
<input type='button' value='edit' class='edit-btn' (click)='hidePara(item,i)' *ngIf="selectedIndex!=i">
<input type='button' value='save' class='save-btn' *ngIf="selectedIndex==i" (click)='hidePara1(item,i)'>
<input type='button' value='DELETE' class='delete-btn' (click)='deleterow(i)'>
</td>
</tr>
</table>
</div>
위, 난 때 사용자 저장 버튼을 클릭 입력 필드의 값를 검색 하려는 내 HTML 코드의 hidePara1를 입력 필드의 값을 얻는 방법 (항목, 난) 함수가 실행되며, 어떻게 이것을 가능하게 할 수 있습니까? 값의 입력 필드를 hidepara1에서 가져오고 싶습니다.타이프 스크립트 파일에 각도 4
hidePara1(item,ii)
{
this.selectedIndex=-1;
this.showHideP = !this.showHideP; //for hiding paragraph
this.tbox = !this.tbox; //showing text box
this.edt=!this.edt; //hide edt button
this.sbtn = !this.sbtn; //display save button
}
hidepara1 함수에서 console.log (item.value)를 작성하면 오류가 표시됩니다 .... 나는 또한 console .log (item) undefined를 알려주세요 – kappo
'hidePara1()'함수 코드를 업데이트 할 수 있습니까? –
질문에 함수를 추가했습니다. – kappo