danielmoncada / date-time-picker

Angular Date Time Picker (Responsive Design)
https://daniel-projects.firebaseapp.com/owlng/date-time-picker
MIT License
141 stars 61 forks source link

"required" attribute with compilation error on angular 9 with fullTemplateTypeCheck option #46

Closed POFerro closed 4 years ago

POFerro commented 4 years ago

Hi,

When compiling an html template with <input matInput [owlDateTime]="birthDatePicker" name="birthDate" [(ngModel)]="client.birthDate" [max]="maxBirthDate" required>

I get the following compilation error: error TS2322: Type 'string' is not assignable to type 'boolean'. Shouldn't this way of setting required be supported? I believe in this case type for required property should be boolean | ''.

Thanks in advance and best regards POFerro

danielmoncada commented 4 years ago

Sorry, I cannot reproduce.

Can you post applicable HTML and component.ts with the date picker / models?

Here is how I'm testing:

<input [(ngModel)]="selectedMoments" 
       [owlDateTimeTrigger]="date_range_component" 
       [owlDateTime]="date_range_component"
       [max]="endValue"
       id="daterange" 
       matInput
       required>
<owl-date-time #date_range_component></owl-date-time>
POFerro commented 4 years ago

Hi Daniel,

My sample html is: <input matInput [owlDateTime]="birthDatePicker" name="birthDate" [(ngModel)]="client.birthDate" required> <owl-date-time #birthDatePicker pickerType="calendar"></owl-date-time> It's basically identical to yours. I believe what's missing for you to reproduce is the setting in tsconfig.json to tell angular compiler to compile the html templates, wich is: "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true, "strictTemplates": true }

Thanks and best regards POFerro

danielmoncada commented 4 years ago

Hi Daniel,

My sample html is: <input matInput [owlDateTime]="birthDatePicker" name="birthDate" [(ngModel)]="client.birthDate" required> <owl-date-time #birthDatePicker pickerType="calendar"></owl-date-time> It's basically identical to yours. I believe what's missing for you to reproduce is the setting in tsconfig.json to tell angular compiler to compile the html templates, wich is: "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true, "strictTemplates": true }

Thanks and best regards POFerro

ahh, yeah, let me give it a try

danielmoncada commented 4 years ago

@POFerro fixed in latest version 9.4.1

POFerro commented 4 years ago

Tks daniel, it's working like a charm ;)