app.component.ts
import { Component } from '@angular/core';
import { NgbCalendar, NgbDate, 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;
today = this.calendar.getToday();
constructor(private calendar: NgbCalendar) {}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - How to show footer in Datepicker
</h4>
<h5><b>Selected Date:</b></h5>
<h5>{{ model | json }}</h5>
<br/>
<form class="row row-cols-sm-auto">
<div class="col-12">
<div class="input-group">
<input
ngbDatepicker
class="form-control"
placeholder="yyyy-mm-dd"
name="dp" [(ngModel)]="model"
[footerTemplate]="footerTemplate"
outsideDays="collapsed"
#d="ngbDatepicker">
<button (click)="d.toggle()">
Open
</button>
</div>
</div>
</form>
<ng-template #footerTemplate>
<hr class="my-0">
<button
class="btn btn-danger btn-sm m-2 float-start"
(click)="d.close()">
Close
</button>
<button
class="btn btn-success btn-sm m-2 float-end"
(click)="model = today; d.close()">
Today
</button>
</ng-template>
- angular bootstrap - Datepicker popup position & target
- angular bootstrap - How to use Accordion
- angular bootstrap - Open an Accordion panel at a time
- angular bootstrap - Toggle Accordion panel on button click
- angular bootstrap - How to prevent toggle Accordion panel
- angular bootstrap - Disable collapse close Accordion panel
- angular bootstrap - How to use Nav
- angular bootstrap - Select Nav tab on button click
- angular bootstrap - Prevent selecting a tab in Nav
- angular bootstrap - How to enable disable tab in Nav
- angular material - How to use stroked Button
- angular material - How to use flat Button
- angular material - How to use icon Button
- angular material - How to use FAB
- angular material - How to use mini FAB