如何在我的控制台日志中显示多个数组数据

时间:2017-04-19 14:46:14

标签: angularjs mongodb angularjs-directive angularjs-ng-repeat

我是angularjs和mongodb的新手,请查看下面的数据和代码..我想在控制台日志中显示数据但是它显示未定义我不知道为什么,我尝试了很多次但是没有成功请大家好帮助我,我非常感谢你,请查看以下代码

var current_schedules = this.current.schedule;
if (angular.isArray(current_schedules)) {
  for (var j = 0; j < current_schedules.length; j++) {
    console.log(current_schedules[j].length);
    for (var i = 0; i < current_schedules[j].length; i++) {
      console.log(current_schedules[j][i].title);
    }
  }
}

//MOngodb Data
"schedule" : [ 
  [ 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f78"),
      "sch_end" : ISODate("2017-04-24T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-24T00:00:00.000Z"),
      "available" : false,
      "title" : "test3"
    }, 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f77"),
      "sch_end" : ISODate("2017-04-25T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-25T00:00:00.000Z"),
      "available" : false,
      "title" : "test4"
    }, 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f76"),
      "sch_end" : ISODate("2017-04-27T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-27T00:00:00.000Z"),
      "available" : false,
      "title" : "test6"
    }
  ], 
  [ 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f78"),
      "sch_end" : ISODate("2017-04-24T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-24T00:00:00.000Z"),
      "available" : false,
      "title" : "test9"
    }, 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f77"),
      "sch_end" : ISODate("2017-04-25T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-25T00:00:00.000Z"),
      "available" : false,
      "title" : "test10"
    }, 
    {
      "_id" : ObjectId("58f76aa9be4d311a78f24f76"),
      "sch_end" : ISODate("2017-04-27T00:00:00.000Z"),
      "sch_start" : ISODate("2017-04-27T00:00:00.000Z"),
      "available" : false,
      "title" : "test11"
    }
  ]
]

when i use console.log(current_schedules); its show data

0 个答案:

没有答案