Richa Shah
Richa Shah

Reputation: 93

How to open ngbDatepicker on click of input

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?

Upvotes: 9

Views: 5551

Answers (2)

SplitterAlex
SplitterAlex

Reputation: 2823

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

Upvotes: 9

Rakesh A R
Rakesh A R

Reputation: 206

Give click function (click)="d.toggle()" to input field instead of giving to calendar icon

Upvotes: 2

Related Questions