app.component.ts
import { Component } from '@angular/core';
import { NgbCalendar, NgbDateStruct }
from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
model: NgbDateStruct;
constructor(private calendar: NgbCalendar) {
this.model = calendar.getToday()
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - Datepicker popup position and target
</h4>
<h5><b>Selected Date:</b></h5>
<h5>{{ model | json }}</h5>
<br/>
<form class="row row-cols-sm-auto">
<div class="col-6">
<div class="input-group">
<input
ngbDatepicker
class="form-control"
placeholder="yyyy-mm-dd"
name="dp"
[(ngModel)]="model"
outsideDays="collapsed"
placement="right-top"
[positionTarget]="dpButton"
#datePicker="ngbDatepicker">
<button #dpButton (click)="datePicker.toggle()">
Open
</button>
</div>
</div>
</form>
- angular bootstrap - Datepicker navigate & select today
- angular bootstrap - Datepicker navigate event
- angular bootstrap - Show multiple months in a Datepicker
- angular bootstrap - Select date range in a Datepicker
- angular bootstrap - How to show footer in Datepicker
- 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 - 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 basic Button
- angular material - How to use raised Button
- angular material - How to use FAB
- angular material - How to use mini FAB