question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Two way binding doesn't work for programmitically changed input values

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

If I change an input’s value programmically, the model that is bound to said value does not update.

Expected behavior

I expect two way binding to cover both user input changes and programmic changes to the input.

Minimal reproduction of the problem with instructions

Simply use two way binding on an input, then change value programmically: <input (input)=“onChange($event, 5, 2, true)” [(ngModel)]=“funcType.hours”> onChange(event) { event.currentTarget.value = “TEST!!!” }

What is the motivation / use case for changing the behavior?

Being able to dynmically validate and change/format user’s data easily

Environment


Angular version: X.Y.Z


Browser:
- [ x] Chrome (desktop) version 64.0
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bcandullocommented, Mar 5, 2018

Being able to dynmically validate and change/format user's data easily Reactive forms has a much better api for this.

1reaction
maximeduprecommented, Apr 3, 2018

I think this is a bug, not a feature. Please see referenced ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two way data binding in angular not working - Stack Overflow
Two way data binding only works for template - component interaction. If you want to send title change to parent component, you should...
Read more >
Programmatic input into a text field doesn't update the binding
Two -way bindings are listening for the input event on the element, which isn't emitted when you manually set the element's .value ,...
Read more >
Keeping Data in Sync with Two-way Binding Using Ngmodel
NgModel works using these two bindings together. First, it passes the data from the component class and set data in FormControl. Second, it ......
Read more >
Two-way data binding - Android Developers
Annotate the method that sets the initial value and updates when the value changes using @BindingAdapter : Kotlin Java More. @BindingAdapter(" ...
Read more >
Two-way bindings in SwiftUI - Hacking with Swift
This is what's called a two-way binding, because any changes to the value of paymentType will update the picker, and any changes to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found