Skip to main content

angular bootstrap - Show multiple months in a Datepicker

app.component.ts

import { Component } from '@angular/core';
import { 
  NgbCalendar, NgbDatepicker, NgbDateStruct 
} from '@ng-bootstrap/ng-bootstrap';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})


export class AppComponent {
  //model:NgbDateStruct;
  model:any;

  constructor(private calendar: NgbCalendar) {}
}
app.component.html

<h4 style="padding-top:25px; padding-bottom:25px;">
  Angular Bootstrap - Show multiple months in a Datepicker
</h4>

<h5><b>Selected Date:</b></h5>
<h5>{{ model | json}}</h5>
<br/>

<ngb-datepicker
  #datePicker
  [displayMonths]="2" 
  [showWeekNumbers]="true" 
  outsideDays="collapsed"
  [(ngModel)]="model">
</ngb-datepicker>
More Angular tutorials