Skip to content

defaultMonth attribute

Keke edited this page Jun 19, 2020 · 6 revisions

Selects specific month and year. Calendar opens to this month/year if a date is not selected. When calendar opens and the date is not selected the selection of the month is given month and the selection of the year is given year. In case the date is already selected its selection overrides the value of the defaultMonth. Value of the defaultMonth attribute can be changed dynamically.

<input angular-mydatepicker [(ngModel)]="model" [options]="myDatePickerOptions" 
    #dp="angular-mydatepicker" [defaultMonth]="defaultMonth">
import {IAngularMyDpOptions, IMyDefaultMonth} from 'angular-mydatepicker';

export class MyApp {
    myDatePickerOptions: IAngularMyDpOptions = {
        // options here...
    }

    // set default month August of 2019
    defaultMonth: IMyDefaultMonth = {
        defMonth: '08/2019'
    };

    constructor() {}

    changeDefaultMonthDynamically(): void {
        this.defaultMonth = {
            defMonth: '09/2020'
        };
    }
}

Clone this wiki locally