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) { }
onClick(datePicker:NgbDatepicker){
// navigate to current month
datePicker.navigateTo();
// select today date
this.model = this.calendar.getToday();
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - Datepicker navigate and select today
</h4>
<h5><b>Selected Date:</b></h5>
<h5>{{ model | json }}</h5>
<br/>
<ngb-datepicker
#datePicker
[(ngModel)]="model">
</ngb-datepicker>
<br/><br/>
<button
(click)="onClick(datePicker)">
Navigate Select Today
</button>
- angular bootstrap - Datepicker navigate event
- angular bootstrap - Datepicker default selected date
- angular bootstrap - Datepicker default visible year month
- angular bootstrap - How to show Datepicker in a popup
- angular material - Button toggle group icon only
- angular material - Show Tooltip on a specific position
- angular material - How to set Tooltip show hide delay
- angular material - How to use Progress bar
- angular material - How to use query Progress bar
- angular material - How to change Divider color
- angular material - How to change vertical Divider height
- angular material - How to change Progress spinner size
- angular material - How to use Tabs
- angular material - How to slow Tabs content transition
- angular material - How to delete Tab programmatically