markDisabled does not support instance method
See original GitHub issueI’m not sure that is a bug or not, but try to access to this
in the markDisabled
callback failed:
isWeekend(date: NgbDateStruct) {
const d = new Date(date.year, date.month - 1, date.day);
return d.getDay() === 0 || d.getDay() === 6;
}
isDisabled(date: NgbDateStruct, current: {month: number}) {
const d = new Date(date.year, date.month - 1, date.day);
return this.isWeekend(date); // this is undefined
}
Bug description:
Link to minimally-working plunker that reproduces the issue:
http://plnkr.co/edit/sPAZc5vKszJZ0PsRQqIO?p=preview
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 4.0.3
ng-bootstrap: 1.0.0-alpha.26
Bootstrap:4.0.0-alpha.6
Thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Ng Bootstrap date range picker [markDisabled] doesn't work ...
On your component.ts, I have made the following changes to your onDateSelection() method. This is not very elegant, but it does the job...
Read more >error: formcontrolname must be used with a parent formgroup ...
This way, calling markPending(false) elsewhere (e.g. a different service validation call) will not prematurely mark this service call as "no longer pending".
Read more >Datepicker - Angular powered Bootstrap
Using ngModel will allow you both to get and set selected value. The model, however, is NOT a native javascript date, see the...
Read more >ionic2-calendar - npmfs
The text displayed when there's no event on the selected date in month view. ... you can call instance method 'loadEvents' event to...
Read more >@ng-bootstrap/ng-bootstrap@14.0.0 - jsDocs.io
If true , panel content will be detached from DOM and not simply ... Returns the calendar service used in the specific datepicker...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure anything can be done about this on the library side - if I remember right, this is sort of related to Angular itself and how it works with binding functions.
Your best bet would be to work around this by defining a function like
The benefit of this is that it preserves the context of
this
regardless of how Angular handles bound functions.in template:
[markDisabled]=“isDisabled(allowedDays)”
in component