angular - Get value with #tag from input, when the input field might not exist -




i have ngfor loop fill table me. in table, there can tables containing more data.

some of elements being filled have 1 mandatory set of input, can obtain value this:

<table *ngif="boolean"> ...     <tr>         <td><input #textinput type=text value="{{defaultvalue}}"/></td>     </tr> ...     <button (click)="save1(stuff, textinput.value)">save</button> </table> 

however, in case have 2 set of input, , 1 or both can present.

<table  *ngif="boolean"> ...     <tr *ngif="boolean2">         <td><input #textinput type=text value="{{defaultvalue}}"/></td>     </tr>     <tr *ngif="boolean3">         <td><input #secondtextinput type=text value="{{defaultvalue}}"/></td>     </tr> ...     <button (click)="save2(stuff, textinput.value, secondtextinput.value)">save</button> </table> 

i tried using ? in case value doesn't exist doesn't work. far can null values. if receive null value if field doesn't exist, not problem, i'll filter it. if both exists, can't value them.

the second code gives me error:

_co.value undefined

same thing if replace 1 of value 0.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -