Ng2 Two-Way bindings stopped working with Webpack


#1

I’m facing a very weird issue after having installed Webpack in my NS+NG2 project.

All two-way bindings between TextField and the model stopped working. I have no errors in the console. Its not in one TextField in particular, but all over the app and in different Pages.

Here’s an exemple of a field.

<TextField 
            [(ngModel)]="address.streetNumber.composedStreetNumber"
            (ngModelChange)="onStreetNumberChange()">
 </TextField>

Neither the field gets populated with the value in the model, nor it triggers the handler callback when we type on it.

Code works fine if I run it with “tns run android”, but it takes between 15sec and 30sec to launch on Android, depending on the model/brand (quite fast on an iPhone 7 though - 2sec), reason for which I’m forced to go with Webpack.

Loading times dropped to less than half (5sec on an OnePlus One), but I cannot figure out what’s causing the two-way bindings not to work.

One way binding still works!

<TextField 
            [text]="address.streetNumber.composedStreetNumber">
</TextField>

I also tried the solution for this issue:


Cloned and replaced nativescript-dev-webpack in my node_modules and updated webpack.common.ts. Either it doesn’t solve it or I did something wrong.

Do you know what might be causing two-way bindings not to work and eventually point me out to the fix?

tns info

 Component        │ Current version │ Latest version │ Information
 nativescript     │ 2.5.4           │ 2.5.4          │ Up to date
 tns-core-modules │ 2.5.2           │ 2.5.2          │ Up to date
 tns-android      │ 2.5.0           │ 2.5.0          │ Up to date
 tns-ios          │                 │ 2.5.0          │ Not installed

Thanks,

Claudio Gomes
DXC Technology