Angularjs and C# - model does not bring value if not changed

Asked

Viewed 39 times

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 C# Viewmodel correctly. The other values (which exist but have not been edited) are passed to Viewmodel as 0 (zero).

I tried to remove the mask, change directives... but nothing helped.

My field is like this:

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

There is another remark: when the value comes to the screen penniless (integer value) and is not changed, when recording, it is passed normally to the Viewmodel.

In Viewmodel, the Property is public and with the Decimal type.

1 answer

0


I found the reason: I had to format the value returned in javascript, before sending it to the action.

The system presented conflict (typed value: 123.45 - presented in Javascript as 123.45 and zeroed in the action). When formatting to 123.45 in Javascript, it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.