Datepicker

The next directive in this chapter is the datepicker. Regardless of the technology you use, dates are always somewhat finicky as every vendor proposes many formats. Also, date internationalization makes things even harder.

Luckily, Bootstrap comes with a simple enough datepicker that allows the user to pick a date in a pop-up calendar graphically. The code for this is given as follows:

<div class="input-group">   <input class="form-control" placeholder="yyyy-mm-dd"       ngbDatepicker #dp="ngbDatepicker">   <div class="input-group-addon" (click)="dp.toggle()" >     <img src="https://ng-bootstrap.github.io/img/calendar-icon.svg"         style="width: 1.2rem; height:              1rem; cursor: pointer;"/>    </div></div>

Many things are going on here. First, we have ...

Get Expert Angular now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.