【发布时间】:2018-05-23 18:48:38
【问题描述】:
我需要在 ngx-bootstrap 日期选择器中添加 TODAY 和 TOMORROW 选项。为此,我更改了bs-current-date-view.component.js 中的以下代码@ 987654324@ 中的代码
BsCurrentDateViewComponent.decorators = [
{ type: Component, args: [{
selector: 'bs-current-date',
template: "<div class=\"current-timedate\"><button (click)=\"currentDate()\" class=\"active\">TODAY</button><button class=\"tomorrow\">TOMORROW</button></div>"
},] },
];
但我无法为其添加功能,以从今天和明天的按钮中获取值。
下面是我尝试过的代码
BsCurrentDateViewComponent.prototype.currentDate = function (en) {
let today = new Date();
let dateObj = {};
dateObj.date = today;
dateObj.isOtherMonth = false;
dateObj.isDisabled = false;
BsDatepickerContainerComponent.prototype.daySelectHandler(dateObj);
alert();
};
BsDatepickerContainerComponent.prototype.daySelectHandler = function (day)
{
console.log(day);
console.log(this._actions.select(day.date));
this._store.dispatch(day);
};
【问题讨论】:
标签: angular typescript datepicker ngx-bootstrap