Есть Сервис:
import matrix from '../customCalendarMatrix/calendarMatrix';
export default class calendarService {
getCalendar(period ,startDate) {
let periodSize = period || 3;
let start = startDate || new Date;
let today = {
year: start.getFullYear(),
month: start.getMonth()
};
console.log(today.month);
let _period = [];
_period['y'+today.year] = {};
for(let i = 0; i < periodSize; i++) {
let subperiod = {};
if(today.month <= 10) {
today.month++;
}else {
today.year++;
_period['y'+today.year] = {};
today.month = 0;
}
_period['y'+today.year]['m'+today.month] = matrix(today.year, today.month);
};
console.log(_period);
return _period;
}
};
есть Компонент:
export default function(){
return {
template: require('./calendar.cmp.html'),
controller: CalendarComponent
}
};
class CalendarComponent {
constructor(calendarService) {
this.calendarService = calendarService;
this.activate();
};
activate() {
this.calendar = this.calendarService.getCalendar(12);
console.log(this.calendar);
}
}
В шаблоне компонента из $ctrl.calendar получаю [] , хотя в консоли
[y2016: Object, y2017: Object]
length:0
y2016:Object
y2017:Object
__proto__:Array[0]
И почему length:0 ?((