Thank you Eric for the answer. 

The problem is that all the fields will be changed in the future, and I 
could not hard-code a field so it will be interpreted as a number, because 
tomorrow that filed could be a text.

My question was more if it's possible, and how, if you don't know the 
fields, to interpret the expression, and understand that is a number, and 
make angular know that is a number


In the mean time I've put the values from the db to come in a text format, 
and not string... so the problem is solved :)

Thank you!

On Thursday, November 27, 2014 5:17:33 PM UTC, Eric Eslinger wrote:
>
> You can write your own sort getter. Instead of orderBy:'age', you can put 
> a function on the scope that does a better job of getting the search key.
>
> Ex:
> $scope.sorter = function(val) {return parseInt(val.age)}
>
> ng-repeat="item in theList | orderBy:sorter"
>
> e
>
>
> On Thu Nov 27 2014 at 8:11:12 AM Leonard Modoran <[email protected] 
> <javascript:>> wrote:
>
>> I have a big json object, that have all the key, values as strings so 
>> they are inside the quotes. 
>>
>> ex. { "Name": "John Doe", "Age": "30"}
>>
>> The problems is if you have multiple fields like this, is that you make a 
>> sorting with orderBy on the ng-repeat, the default sorting is by name, and 
>> it's working the same also for numbers.
>>
>> so the order will be 1, 10, 11, 2, 20 ,25,3, 40   instead of 1, 2, 3, 10, 
>> 11, 20, 25,40 
>>
>>
>> How to convert it so will see it as a number, and this by not altering 
>> the json values.
>>
>>
>> Thank you!
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/d/optout.

Reply via email to