I want to open bootstrap 4 date picker on the click of input field. i don't want to display calender icon How can I resolve this issue?
Asked
Active
Viewed 4,895 times
2 Answers
9
You can do something like this:
<input
readonly
placeholder="yyyy-mm-dd"
class="form-control"
ngbDatepicker
(click)="datePicker.toggle()"
#datePicker="ngbDatepicker">
I created a small demo example here: https://stackblitz.com/edit/angular-anhgsg

SplitterAlex
- 2,755
- 2
- 20
- 23
-
I have tried your example, it is working but I have to click 2 times to close the calender – Richa Shah Feb 22 '18 at 09:46
-
what is the desired behaviour? – SplitterAlex Feb 22 '18 at 09:49
-
I want to call one function based on selected date. – Richa Shah Feb 22 '18 at 09:53
-
Also, what I want is to open calender on clicking of input and close the calender after selecting the date. – Richa Shah Feb 22 '18 at 09:55
2
Give click function (click)="d.toggle()"
to input field instead of giving to calendar icon

Rakesh A R
- 186
- 1
- 2
- 17