Two way binding doesn't work for programmitically changed input values
See original GitHub issueI’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:
- Created 6 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Being able to dynmically validate and change/format user's data easily
Reactive forms has a much better api for this.I think this is a bug, not a feature. Please see referenced ticket.