AngularJS中如何去掉 ng-repeat的自动排序?
varrecords={"2013":[{order_year:"2013",order_date:"3-5",order_number:"A123445678",mil...
var records = {
"2013": [
{order_year:"2013", order_date:"3-5", order_number: "A123445678", mileage: 20000, sname: "华盛汽车" },
{order_year:"2013", order_date:"6-5", order_number: "A123445678", mileage: 28000, sname: "华盛汽车" },
{order_year:"2013", order_date:"3-25", order_number: "A123445678", mileage: 16000, sname: "华盛汽车" }
],
"2016": [
{order_year:"2016", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
],
"2012": [
{order_year:"2012", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
]};
这样一个数组,ng-repeat输出时自动按年份进行了排序,按照2012、2013、2016的顺序显示,但我需要按数组原顺序显示,不知如何禁止它自动帮我排序? 展开
"2013": [
{order_year:"2013", order_date:"3-5", order_number: "A123445678", mileage: 20000, sname: "华盛汽车" },
{order_year:"2013", order_date:"6-5", order_number: "A123445678", mileage: 28000, sname: "华盛汽车" },
{order_year:"2013", order_date:"3-25", order_number: "A123445678", mileage: 16000, sname: "华盛汽车" }
],
"2016": [
{order_year:"2016", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
],
"2012": [
{order_year:"2012", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
]};
这样一个数组,ng-repeat输出时自动按年份进行了排序,按照2012、2013、2016的顺序显示,但我需要按数组原顺序显示,不知如何禁止它自动帮我排序? 展开
1个回答
展开全部
$scope.records = {
"2013": [
{order_year:"2013", order_date:"3-5", order_number: "A123445678", mileage: 20000, sname: "华盛汽车" },
{order_year:"2013", order_date:"6-5", order_number: "A123445678", mileage: 28000, sname: "华盛汽车" },
{order_year:"2013", order_date:"3-25", order_number: "A123445678", mileage: 16000, sname: "华盛汽车" }
],
"2016": [
{order_year:"2016", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
],
"2012": [
{order_year:"2012", order_date:"3-25", order_number: "A123445678", mileage: 14000, sname: "华盛汽车" }
]};
$scope.keys = Object.keys($scope.records);
<div ng-repeat="key in keys">
{{records[key]}}
</div>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询