|
1 |
| -import { Component, OnInit, ViewChild } from '@angular/core'; |
| 1 | +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; |
2 | 2 | import { IgxCalendarComponent, IgxDialogComponent, DateRangeType, CalendarView } from 'igniteui-angular';
|
| 3 | +import { type } from 'os'; |
3 | 4 | import { IViewDateChangeEventArgs } from '../../../projects/igniteui-angular/src/lib/calendar/calendar-base';
|
4 | 5 |
|
5 | 6 | @Component({
|
6 | 7 | selector: 'app-calendar-sample',
|
7 | 8 | templateUrl: 'calendar.sample.html',
|
8 | 9 | styleUrls: ['calendar.sample.scss']
|
9 | 10 | })
|
10 |
| -export class CalendarSampleComponent implements OnInit { |
| 11 | +export class CalendarSampleComponent implements OnInit, AfterViewInit { |
11 | 12 | @ViewChild('calendar', { static: true }) calendar: IgxCalendarComponent;
|
12 | 13 | @ViewChild('calendar1', { static: true }) public calendar1: IgxCalendarComponent;
|
13 | 14 | @ViewChild('alert', { static: true }) public dialog: IgxDialogComponent;
|
14 | 15 | public range = [];
|
15 | 16 | public today = new Date();
|
| 17 | + public ppNovember = new Date(this.today.getFullYear(), this.today.getMonth() + 1, 10); |
16 | 18 | public rangeDisabled = [
|
17 | 19 | new Date(this.today.getFullYear(), this.today.getMonth(), 10),
|
18 | 20 | new Date(this.today.getFullYear(), this.today.getMonth(), 13)
|
19 | 21 | ];
|
20 | 22 |
|
21 | 23 | public ngOnInit() {
|
22 | 24 | this.calendar1.disabledDates = [{ type: DateRangeType.Between, dateRange: this.rangeDisabled }];
|
| 25 | + this.calendar.selectDate([ new Date(this.today.getFullYear(), this.today.getMonth(), 10), |
| 26 | + new Date(this.today.getFullYear(), this.today.getMonth(), 17), |
| 27 | + new Date(this.today.getFullYear(), this.today.getMonth(), 27)]); |
| 28 | + } |
| 29 | + |
| 30 | + public ngAfterViewInit() { |
| 31 | + //this.calendar.selectDate(new Date(this.today.getFullYear(), this.today.getMonth(), 10)); |
| 32 | +/* [ new Date(this.today.getFullYear(), this.today.getMonth(), 10), |
| 33 | + new Date(this.today.getFullYear(), this.today.getMonth(), 17), |
| 34 | + new Date(this.today.getFullYear(), this.today.getMonth(), 27)]) */ |
| 35 | + console.log(this.calendar.selectedDates); |
23 | 36 | }
|
24 | 37 |
|
25 | 38 | public selectPTOdays(dates: Date[]) {
|
|
0 commit comments