AngularJS orderby integer field not working properly

后端 未结 6 1344
無奈伤痛
無奈伤痛 2021-01-02 05:45

I just took the simplest demo from http://docs.angularjs.org/api/ng.filter:orderBy and just change the value of age to have different number of digit. It stop working as it

6条回答
  •  星月不相逢
    2021-01-02 06:10

    You just have to remove quotes in age variable because it's an integer, not a string:

      $scope.friends =
          [{name:'John', phone:'555-1212', age:2352345},
           {name:'Mary', phone:'555-9876', age:4235243},
           {name:'Mike', phone:'555-4321', age:241},
           {name:'Adam', phone:'555-5678', age:34325},
           {name:'Julie', phone:'555-8765', age:1234}]
    

提交回复
热议问题