0

I am using the "owl-date-time" component as follows

<input type="text" class="form-control"
             [owlDateTime]="startDate"
             [(ngModel)]="fromDate">
<div class="input-group-addon" [owlDateTimeTrigger]="startDate" >
    <i class="fa fa-calendar"></i>
</div>
<owl-date-time #startDate showSecondsTimer="true" (afterPickerOpen)="onOpenStartDate($event)" ></owl-date-time>

In the html dom I see this:

enter image description here

As seen in the image I want to access some very inner input element and force the pattern field on the input element to be pattern="[0-9]{2}" or something similar

Can this be done?

Maayan Hope
  • 1,482
  • 17
  • 32
  • No, unless the author of that library offers an interface for this matter. – Philipp Meissner Jan 13 '22 at 13:52
  • 2
    the best way is to be allowed by your library API. So check its doc to see if they allow a pattern to their input. Otherwise, you have to use jQuery, which is not recommended, and will break if the library ever evolves... – Random Jan 13 '22 at 13:53
  • This gives you a very good explanation https://stackoverflow.com/a/36528769/15036361. Beware that the best solution would be for the library to support those changes. Also, the solutions provided in the link are now deprecated, with no other alternatives. – Leonardo Freire Jan 13 '22 at 14:26

0 Answers0