Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Angular bind only when mouse moves

I have a very weird problem. I've got an input and I want to show a button only when the input has a value. It's working only if i move the mouse.

<input class="form-control"
   type="text"
   placeholder="hello there..."
   #helloInput
>

{{helloInput.value}} --> not shows until mouse is moving

<button class="btn btn-success"
   *ngIf="helloInput.value"
>Show me</button>

It's very weird. Any idea?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Angular updates view only by calling change detection. Most of the time it happens automatically because of Event listeners/XHR/setTimeout/setInterval calls.

In your example there's no any event listener known by Angular. Since it's updated by mousemove then there's some listener for it and Angular detected that.

In order to update your view on any input value change you can simply add empty input event listener:

<input class="form-control"
   type="text"
   placeholder="hello there..."
   #helloInput
   (input)="0"  <=============== this one
>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!