Answer the question
In order to leave comments, you need to log in
Why is the Angular component not working?
There is a Service:
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);
}
}
[y2016: Object, y2017: Object]
length:0
y2016:Object
y2017:Object
__proto__:Array[0]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question