我正在尝试将我的对象(事件)的属性从后端保存到日历的新变量中。这是我的代码:
编辑:
function getEvents(object){
TimeSlotsModel.all()
.then(function (result) {
vm.data = result.data.data;
angular.forEach(vm.data, function(value,key) {
angular.forEach(value, function(value,key) {
var id = value;
var name = value;
var location = value;
var allDay = value;
var startDay = value;
var endDay = value;
var startTime = value;
var endDay = value;
var user = value;
console.log(id);
})
})
})
}
它在控制台中有以下输出:
controllers.js:159 Object {id: "20", descriptives: Object, dates: Object}
controllers.js:159 20
controllers.js:159 Financial Management
controllers.js:159
controllers.js:159 SR22
controllers.js:159 null
controllers.js:159 2015-12-30T16:00:00.000Z
controllers.js:159 59400
controllers.js:159 66600
controllers.js:159
controllers.js:159 Object {id: "21", descriptives: Object, dates: Object}
controllers.js:159 21
controllers.js:159 Accounting II
controllers.js:159
controllers.js:159 SR 2
controllers.js:159 null
controllers.js:159 2015-12-29T16:00:00.000Z
controllers.js:159 2015-12-30T16:00:00.000Z
controllers.js:159 14400
我应该怎么做才能将这些单独的字段保存到我的新变量中?