Throw error A 'return' statement can only be used within a function body

Throw error A ‘return’ statement can only be used within a function body.

code :
<input type=“tel” placeholder=“Mobile No” name=“mobile” [(ngModel)]=“mobile” required
maxlength=“10” minlength=“10” pattern="[1][0-9]*$" onkeypress=“return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57” />

Showing error in return which is in input type in ionic 6 , but code is working fine , and other version of ionic its not showing any error.


  1. 1-9 ↩︎