我想弄清楚如何让jquery函数调用封闭Angular 2组件中的方法。我在Angular 2项目中使用了https://github.com/mdehoog/Semantic-UI-Calendar组件。我已经声明任何类型的jQuery的一个常量,然后在我的ngOnInit
我这样做:jquery call angular 2组件方法
jQuery('#monthYearPicker').calendar({
type: 'month',
maxDate: new Date(),
// minDate and maxDate take new Date() objects
onChange: function(date, text, mode) {
console.log("Date is " + date);
console.log("Text is " + text);
}
});
我看到控制台日志预期。我现在没有得到的是,我怎样才能回到我的组件中,以便我可以在这一点上做'正常'的东西?例如,我现在想调用我的方法来查询web服务并传入选定的日期。