Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputItem onChange doesn't work #793

Closed
ferrry1090 opened this issue Jun 2, 2021 · 1 comment
Closed

InputItem onChange doesn't work #793

ferrry1090 opened this issue Jun 2, 2021 · 1 comment

Comments

@ferrry1090
Copy link

Version

4.0.0

Environment

PROD

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-mobile-start-fthfk5?file=src/app/app.component.ts

Steps to reproduce

Inside my HTML

<div class="am-list" style="margin: 0">
  <div class="am-list-body">
	<InputItem
	  [type]="'text'"
	  [content]="'Name'"
	  [(ngModel)]="accInput"
	  [extra]="iconSearch"
	  (onChange)="validateName($event)"
	>
	</InputItem>
  </div>
  <p
	style="color: #ff0000; font-size: 12px !important"
	*ngIf="accError"
  >
	This field is required!
  </p>

  <ng-template #iconSearch>
	<img
	  [src]="'../../assets/svg/search.svg'"
	  class="icon"
	  (click)="find()"
	/>
  </ng-template>
</div>

Inside my Component

accInput: any = '';
accError = false;

validateName(input) {
	this.accInput = input;

	if (
	  this.accInput === '' ||
	  this.accInput === undefined ||
	  this.accInput === null
	) {
	  this.accError = true;
	} else {
	  this.accError = false;
	}
}

find() {
	if (
	  this.accInput !== null &&
	  this.accInput !== undefined &&
	  this.accInput !== ''
	) {
	  triggerAPI();
	} else {
	  triggerToastFailed();
	}
}

I have a problem when I input name field in my Mobile Device Samsung Note 10, seems like the onChange doesn't work.
From the above code, it is working if I run my code in localhost and I test using chrome browser change it to Mobile view.
But it doesn't work when I deploy the code and view it in my Mobile Device.
The thing is, it doesn't happened to type Password & Money. It only happened to type Text.
Can anyone point out what did I missed out?

Thanks in advance!

What is expected?

Input type Text onChange should read the change value when user input.

What is actually happening?

Input type Text onChange, doesn't update the latest value.

Other?

I tried to replicate in stackblitz but not sure why error, I have added the dependencies.

@xcLtw
Copy link
Collaborator

xcLtw commented Feb 21, 2022

fixed with #818

@xcLtw xcLtw closed this as completed Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants