I have followed the undermentioned steps and I have been able to achieve up to the following image.
<ngb-datepicker></ngb-datepicker> I am able to see this type of screen.

But I am not able to understand how to use input[ngbDatepicker]
I tried <input ngbDatepicker /> but only a text box appears. When I focus it, it is not showing the date picker.
Here is the link which I am using.
To display datepicker on focus you can use focus event of input by using template reference as below :
<input ngbDatepicker #d="ngbDatepicker" (focus)="d.open()">
Or you can add trigger toggle event of datepicker on button click as per Datepicker in a popup example of Datepicker
// Component
@Component({
selector: 'ngbd-datepicker-popup',
templateUrl: './datepicker-popup.html'
})
export class NgbdDatepickerPopup {
model;
}
// HTML
<div class="input-group">
<input class="form-control" placeholder="yyyy-mm-dd" name="dp" [(ngModel)]="model" ngbDatepicker #d="ngbDatepicker">
<div class="input-group-addon" (click)="d.toggle()" >
<img src="img/calendar-icon.svg" style="width: 1.2rem; height: 1rem; cursor: pointer;"/>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With