Angular JS orderBy 2属性不起作用

时间:2016-09-07 18:26:30

标签: javascript angularjs sorting angularjs-orderby

我正在尝试按makemodel按字母顺序对我的应用的汽车广告资源进行排序,而我只能通过make对其进行排序。我还尝试按makeyear排序,但同样只按make排序。

orderBy按字母顺序和数字排序吗?

这是我的代码:

<div class="row gallery-container" ng-init="getCars();">
  <div class="inventory-title">
    <h2>Current Inventory</h2>
  </div>
  <div class="car-container">
  <div ng-repeat="car in cars | orderBy:['make','model']">
    <div class="col-md-10 col-ms-10 col-sm-10 col-md-offset-1 col-sm-offset-1 col-ms-offset-1">
      <a ng-href="/#/car/{{car._id}}" class="no-style-link-thumb">
        <div class="thumbnail inventory-car-containter">
            <img ng-src="{{car.picture.url | fpConvert: {filter:'sharpen', w:750, h:375} }}" />
          <div class="caption text-center">
            <p class="yr-mk-mdl">{{car.year}} {{car.make}} {{car.model}}</p>
            <p class="price">{{car.price}}</p>
          </div>
        </div>
      </a>
    </div>
</div>

这是我的车型:

'use strict';
module.exports = (mongoose, models) => {
// Defines the car schema
  let CarSchema = mongoose.Schema({
     make: {type: String, required: true},
     model: {type: String, required: true},
     year: {type: String, required: true},
     createdAt: {type: Date, default: Date.now}
});

// Sets the createdAt parameter equal to the current time
CarSchema.pre('save', function(next){
  var now = new Date();
  if (!this.createdAt) {
      this.createdAt = now;
  }
  next();
});

// Exports the CarSchema for use elsewhere.
let Car = mongoose.model('Car', CarSchema);
models.Car = Car;
};

我希望它能像这样对列表进行排序:
- 阿斯顿马丁DB5
-Ferrari 250 California Spyder SWB
-Ferrari 458
-Porsche 911

这是目前对列表进行排序的方式:
- 阿斯顿马丁DB5
-Ferrari 458
-Ferrari 250 California Spyder SWB
-Porsche 911

1 个答案:

答案 0 :(得分:0)

看起来表达式是按角度计算(评估?) - 而不是传递' do not display alerts while processing so many files Application.DisplayAlerts = False wbNew.SaveAs FileName:=path, FileFormat:=51, CreateBackup:=False ' add a little Workbook_Open method to the new workbook's ThisWorkbook dynamically ' this line doesn't actually do anything - why? wbNew.VBProject.VBComponents.Item("ThisWorkbook").CodeModule.AddFromString ( _ "Private Sub Workbook_Open()" & vbCrLf _ & " Application.AskToUpdateLinks = False" & vbCrLf _ & " Application.DisplayAlerts = False" & vbCrLf _ & "End Sub") wbNew.Save wbNew.Close ,你应该尝试以下方法:

['make','model']