AngularJS and C # - model brings no value if not changed

0

I have a form where some fields are numeric (decimal format with 2 houses). I'm displaying formatted and masked, all correct.

What happens is that when I edit one of the values, this edited value is passed to the C # ViewModel correctly. The remaining values (which exist but have not been edited) are passed to the ViewModel as 0 (zero).

I've tried removing the mask, changing directives ... but it did nothing.

My field looks like this:

<input ng-model="meuModelo.CubagemM3" type="text" maxlength="15" format="number" centsLimit="3">

There is another point: when the value comes to the screen without cents (integer value) and does not change, when it is saved, it is normally passed to the ViewModel.

In the ViewModel, the property is public and of type Decimal.

    
asked by anonymous 10.12.2016 / 21:58

1 answer

0

I discovered the reason: it was necessary to format the value returned in the javascript, before sending it to the action.

The system had a conflict (typed value: 123.45 - displayed in javascript as 123.45 and getting zeroed in on the action). When formatting for 123.45 in Javascript, it worked.

    
22.12.2016 / 21:54