Below is my .html file
<div class="p-field p-grid">
<label for="username" class="p-col-fixed" style="width: 100px;">Username</label>
<div class="p-col">
<input
type="text"
id="username"
name="username"
ngModel
required
pInputText
#username="ngModel"
(keypress)="enterkeypress($event)"
>
<span class="help-block" *ngIf="!username.valid && username.touched">Please enter an username!</span>
</div>
</div>
Below is my .ts file (showing only enterkeypress function)
enterkeypress(e) {
console.log(e.target.value);
}
Output
When i Entered the word R its showing me Empty output
When i Entered the second word T its showing me previous output R
And So ON, its always giving me previous value instead of current value
Please Help!!!!!!!! Thanks in Advance