NgbDatepicker markDisabled 没有其父组件的作用域
NgbDatepicker markDisabled does not have scope of its parent component
我正在尝试让它工作:
http://plnkr.co/edit/xIc89cfoD1R8qn8Ojrht?p=preview
要触发错误,请尝试打开日历。
基本上 markDisabled
回调无法访问其被调用的组件。
我相信它应该,是吗?这是 ng-bootstrap
实施方式的问题吗?
还有其他方法吗?
Angular 中的传递方法通常不会以这种方式工作(根据我的经验)。
为了让这样的事情起作用,我将该方法分配给一个变量:
isDisabled = (date: NgbDateStruct, current: {month: number}) => {
console.log('Allow Weekend', this.allowWeekend);
return date.month !== current.month;
}
我正在尝试让它工作:
http://plnkr.co/edit/xIc89cfoD1R8qn8Ojrht?p=preview
要触发错误,请尝试打开日历。
基本上 markDisabled
回调无法访问其被调用的组件。
我相信它应该,是吗?这是 ng-bootstrap
实施方式的问题吗?
还有其他方法吗?
Angular 中的传递方法通常不会以这种方式工作(根据我的经验)。
为了让这样的事情起作用,我将该方法分配给一个变量:
isDisabled = (date: NgbDateStruct, current: {month: number}) => {
console.log('Allow Weekend', this.allowWeekend);
return date.month !== current.month;
}