Hi Darren,

Thanks for the reply, it's exactly what I'm after.

I am trying to parse the input text in my own way. Plus, I don't want to 
use number due to spinbox control and the fact that I won't be able to 
provide validation error message for non-numeric input.

Looks like directive is the way to go from here.

Thanks again,

Felix


On Tuesday, February 4, 2014 2:51:44 AM UTC+11, Darren Ballinger wrote:
>
> Hi Felix
>
> If you set the 'type' attribute in the input to 'number' then the value 
> should be deserialised to an int. If you want to be able to parse input 
> text in your own custom way you can add a parser to the form controller. 
> Take a look at the smart-float directive in 
> http://docs.angularjs.org/guide/forms.
>
> Regards
> Darren
>
>
> On Monday, 3 February 2014 12:59:29 UTC, Felix Satyaputra wrote:
>>
>> Hi All,
>>
>> I am trying to understand how Angular decides a particular input is a 
>> string or a numeric when it deserializes the view back to the model.
>>
>> I have an input type text which was bound to a numeric JSON property 
>> through ng-model. I have attached ng-blur which will send the value of the 
>> textfield via ajax request.
>>
>> The thing I don't understand is this: if I enter the correct numeric 
>> value into the textfield, the JSON property sent to the server is string 
>> instead of number.
>>
>> Has anyone encounter something similar to this? How does Angular decides 
>> if something is a numeric or a string?
>>
>> Thank you for your time!
>>
>> Regards,
>>
>> Felix
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to