Questions tagged [two-way-binding]

351 questions
6
votes
3 answers

two-way binding - nested object - angular - Cannot read property of undefined

I want to use [(ngModel)] for a nested object, but is giving me an error Cannot read property 'mxn' of undefined these are the data structure of my models: company.model.ts import Currency from './currency.model'; class Company { _id: string; name:…
Milad
  • 95
  • 1
  • 11
6
votes
2 answers

Angular 2 - How to get rid of extra decimals in angular binding?

i have such a statement in my view and the binding has value lets says 6970.87127381382131831 but, i want to limit it at 2 decimal at most. Since i am listing elements with ngFor, could not use an object to limit it with .toFixed(2). Thank you all…
ozer
  • 522
  • 1
  • 6
  • 23
5
votes
1 answer

How to bind SWIFTUI Button action to viewmodel action or method

I am trying to bind swiftui button action and getting the error like Cannot convert value of type 'Binding<() -> ()>' to expected argument type '() -> Void' In View Button(action : $viewModel.action ) { Text("Login") …
Prathap
  • 399
  • 1
  • 4
  • 13
5
votes
2 answers

How can Two-way Data Binding leads to infinite loops?

I'm learning Data Binding by reading up on the official docs. Everything makes sense expect the possible infinite loops in the two-way binding. As per the official docs on two-way binding: Be careful not to introduce infinite loops when using…
Harry
  • 1,151
  • 11
  • 27
5
votes
1 answer

Android Data Binding two way binding with array

I want to achieve two-way binding on a array with Data Binding in Android. This is a simplified version of the code I have:
Jelmer Brands
  • 192
  • 2
  • 9
5
votes
2 answers

msg:Cannot find the getter for attribute 'android:text' with value type java.lang.String in data binding?

I am trying to use data binding in the edittext, In the morning it is working fine but suddenly got the error: ****/ data binding error ****msg:Cannot find the getter for attribute 'android:text' with value type java.lang.String on…
5
votes
2 answers

Add editing to MVVM in a hierarchical data structure

This question is a follow-up of this older one, and it's more of a confirmation than an open question. My ViewModel instance has a private instance of the Model, _modelInst. The ViewModel has exclusive access to the Model's data during editing (so…
Martin Hennings
  • 16,418
  • 9
  • 48
  • 68
5
votes
3 answers

ListBox TwoWay bind to SelectedItem

I've seen this question asked numerous times and have gone over my code over and over. But when I assign to my SelectedItem-bound property with an object, it does not update the display's selected item. It appears that the ListBox thinks the…
Thomas
  • 3,348
  • 4
  • 35
  • 49
4
votes
1 answer

Two-way binding for select element doesn't work properly | Angular 11

I have a JSON with structure: For item "item": { "pk": "123456", "title": "Title4", "list_fields": [ { "pk": "12345", "title": "Selector", "type": "SEL", …
s_spirit
  • 111
  • 10
4
votes
1 answer

Angular: Chained two-way property bind

I am trying to extend 3rd party component with some custom functionality by wrapping it into custom component. But I am having issues with property binding - how do I create two-way property bind between parent, wrapper, and 3rd party component? (A…
djulb
  • 375
  • 1
  • 3
  • 19
4
votes
1 answer

How to preserve two-way-binding using ngTemplateOutlet context (Angular7)

I need to setup some configuration forms, which will be shown on screen dynamically. The object behind the logic is deeply nested, so I need to react to its structure (e.g. using ngFor). Since content on different layers inside the object can have…
Sabselol
  • 43
  • 1
  • 5
4
votes
1 answer

Why I can not limit an input's value length with Angular NgModel?

I have an input field with two way binding and I want to change the user input to uppercase and limit it to 3 characters. I'm doing this in the setter of the variable. The uppercase replacement works if I try to do a substring it does not update the…
Milhooz
  • 43
  • 1
  • 5
4
votes
1 answer

Ternary operator for two way data binding

I am using ternary operator on observable field to set the text to textview in xml.But its gives me following error at compile time. ****/ data binding error ****msg:The expression ((vmEnteredAmountGetJavaLangString0) ? ("") : (vmEnteredAmountGet))…
sanil
  • 482
  • 1
  • 7
  • 23
4
votes
2 answers

Convert one-way data binding to two-way using Android Architecture Components

I am refactoring my Android app for an University project to use Architecture Components and I am having a hard time implementing two-way data binding on a SwitchCompat. The app has got a simple user interface with a TextView displaying the status…
4
votes
2 answers

Protractor .sendKeys() not working on inputs with ngModel

I haven't been able to find anything on this topic, so I figured I would ask. I'm currently writing E2E tests on my Angular 5 application. E2E is being performed by Protractor as configured in a default Angular CLI generator project. I need the…
Nate
  • 345
  • 3
  • 12
1
2
3
23 24